chroma/lexers/testdata/promela/calc.actual
2025-03-22 20:46:00 +13:00

20 lines
289 B
Text

// reverse polish
mtype = { operator, value }
chan f = [12] of { mtype, int }
proctype calc(chan you)
{ int s, lft, rgt
chan me = [0] of { int }
if
:: f?operator(s)
run calc(me); me?lft
run calc(me); me?rgt
if
:: s == '+' -> you!(lft+rgt)
fi
:: f?value(s) -> you!s
fi
}