Lengyel forma (Postfix expression)

Animáció

Struktogram

$LengyelForma()$

$V : Stack$
$read(x)$

$Operandus(x)$

$x = '('$

$x = ')'$

$Operátor(x)$
$write(x)$ $V.push(x)$ $V.top() \neq '('$
$BalJobbOperátor(x)$

$write(V.pop())$ $\neg V.IsEmpty() \land V.top() \neq '('$
$\land pr(V.top()) \geq pr(x)$
$\neg V.IsEmpty() \land V.top() \neq '('$
$\land pr(V.top()) > pr(x)$
$V.pop()$ $write(V.pop())$ $write(V.pop())$
$V.push(x)$ $V.push(x)$
$\neg V.IsEmpty()$
$write(V.pop())$

Feladatok