-- ordinary rules True. Bool ::= "true" ; False. Bool ::= "false" ; SDecl. Stm ::= Type Ident "=" Exp ";" ; decl. Stm ::= Type 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; BExp. Exp ::= Exp1 BOp Exp1 ; op1. Exp1 ::= Exp1 Op1 Exp2 ; define op1 e1 o e2 = OpExp e1 o e2 ; op2. Exp2 ::= Exp2 Op2 Exp3 ; define op2 e1 o e2 = OpExp e1 o e2 ; 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] ; Lt. BOp ::= "<" ; ELt. BOp ::= "<=" ; Gt. BOp ::= ">" ; EGt. BOp ::= ">=" ; Eq. BOp ::= "==" ; NEq. BOp ::= "!=" ; Plus. Op1 ::= "+" ; Minus. Op1 ::= "-" ; Times. Op2 ::= "*" ; Div. Op2 ::= "/" ; _. Op ::= Op1; _. Op ::= Op2; TInt. Type ::= "int" ; TBool. Type ::= "bool" ; -- pragmas internal ExpT. Exp ::= Type Exp ; internal SNoop. Stm ::= ; internal EDefault. Exp ::= ; internal OpExp. Exp ::= Exp Op Exp ; internal NoType. Type ::= ; comment "/*" "*/" ; comment "//" ; entrypoints Stms, Exp ;