-- ordinary rules True. Bool ::= "true" ; False. Bool ::= "false" ; SDecl. Stm ::= Typ Ident "=" Exp ";" ; decl. Stm ::= Typ Ident ";" ; define decl t v = SDecl t v EDefault ; SExp. Stm ::= Exp ";" ; SBlock. Stm ::= "{" [Stm] "}" ; if. Stm ::= "if" "(" Exp ")" Stm ; SIf. Stm ::= "if" "(" Exp ")" Stm "else" Stm ; define if e s = SIf e s SNoop ; SWhile. Stm ::= "while" "(" Exp ")" Stm ; -- SFor. Stm ::= "for" "(" Stm Exp ";" Exp ")" Stm ; SPrint. Stm ::= "print" Exp ";" ; -- VVar. Var ::= Ident ; -- VAss. Var ::= Ident "=" Exp; ELt. Exp ::= Exp1 "<" Exp1 ; EELt. Exp ::= Exp1 "<=" Exp1 ; EGt. Exp ::= Exp1 ">" Exp1 ; EEGt. Exp ::= Exp1 ">=" Exp1 ; EEq. Exp ::= Exp1 "==" Exp1 ; ENEq. Exp ::= Exp1 "!=" Exp1 ; EPlus. Exp1 ::= Exp1 "+" Exp2 ; EMinus. Exp1 ::= Exp1 "-" Exp2 ; ETimes. Exp2 ::= Exp2 "*" Exp3 ; EDiv. Exp2 ::= Exp2 "/" Exp3 ; EIncr. Exp3 ::= Ident "++" ; EDecr. Exp3 ::= Ident "--" ; EVar. Exp3 ::= Ident ; EAss. Exp3 ::= Ident "=" Exp; EInt. Exp3 ::= Integer ; ENeg. Exp3 ::= "-" Exp3 ; EBool. Exp3 ::= Bool ; EReadI. Exp3 ::= "readInt" ; EReadB. Exp3 ::= "readBool" ; coercions Exp 3 ; _. Stm ::= Stm ";" ; terminator Stm "" ; Program. Stms ::= [Stm] ; TInt. Typ ::= "int" ; TBool. Typ ::= "bool" ; -- pragmas internal ExpT. Exp ::= Typ Exp ; internal SNoop. Stm ::= ; internal EDefault. Exp ::= ; comment "/*" "*/" ; comment "//" ; entrypoints Stms, Exp ;