declare fun {Stat S1 Sn} T|S2=S1 in case T of begin then {Sequence Stat fun {$ X} X==';' end S2 'end'|Sn} [] 'if' then C X1 X2 S3 S4 S5 S6 in C={Comp S2 S3} S3='then'|S4 X1={Stat S4 S5} S5='else'|S6 X2={Stat S6 Sn} 'if'(C X1 X2) [] while then C X S3 S4 in C={Comp S2 S3} S3='do'|S4 X={Stat S4 Sn} while(C X) [] read then I in I={Id S2 Sn} read(I) [] write then E in E={Expr S2 Sn} write(E) elseif {IsIdent T} then E S3 in S2=':='|S3 E={Expr S3 Sn} assign(T E) else S1=Sn raise error(S1) end end end