-- ordinary rules
-Program. Stms ::= [Stm] ;
+
+True. Bool ::= "true" ;
+False. Bool ::= "false" ;
+
+TInt. Type ::= "int" ;
+TBool. Type ::= "bool" ;
+
+Program. Program ::= [FuncStm] ;
-SExp. Stm ::= Exp ";" ;
-SBlock. Stm ::= "{" [Stm] "}" ;
-SDecl. Stm ::= Type Ident "=" Exp ";" ;
-decl. Stm ::= Type Ident ";" ;
-define decl t v = SDecl t v EDefault ;
+SExp. Stm ::= Exp ";" ;
+SBlock. Stm ::= "{" [Stm] "}" ;
+SDecl. Stm ::= Type Ident "=" Exp ";" ;
+SDeclD. Stm ::= Type Ident ";" ;
+
SWhile. Stm ::= "while" "(" Exp ")" Stm ;
SIf. Stm ::= "if" "(" Exp ")" Stm "else" Stm ;
-- SFor. Stm ::= "for" "(" Stm Exp ";" Exp ")" Stm ;
SPrint. Stm ::= "print" Exp ";" ;
+SReturn. Stm ::= "return" Exp ";" ;
+
EAss. Exp ::= Ident "=" Exp;
EReadI. Exp3 ::= "readInt" ;
EReadB. Exp3 ::= "readBool" ;
+EFunc. Exp3 ::= Ident "(" [Exp] ")" ;
+
+
coercions Exp 3 ;
terminator Stm "" ;
+separator Exp "," ;
+
+Decl. Decl ::= Type Ident ;
+
+separator Decl "," ;
+
+Func. Func ::= Type Ident "(" [Decl] ")" "{" [Stm] "}" ;
+
+separator Func "" ;
+
+S. FuncStm ::= Stm ;
+F. FuncStm ::= Func ;
+
+separator FuncStm "" ;
+
+-- E1. Exps ::= Exp ;
+-- E2. Exps ::= Exp "," Exps ;
Lt. Op0 ::= "<" ;
ELt. Op0 ::= "<=" ;
_. Op ::= Op0;
-True. Bool ::= "true" ;
-False. Bool ::= "false" ;
-
-TInt. Type ::= "int" ;
-TBool. Type ::= "bool" ;
-
-- pragmas
-internal ExpT. Exp ::= Type Exp ;
-internal SNoop. Stm ::= ;
-internal EDefault. Exp ::= ;
+-- internal ExpT. Exp ::= Type Exp ;
+-- internal EDefault. Exp ::= ;
internal BiOpExp. Exp ::= Exp Op Exp ;
-internal NoType. Type ::= ;
+-- internal NoType. Type ::= ;
internal EPost. Exp ::= Ident Op1 ;
+internal SNoop. Stm ::= ;
+
comment "/*" "*/" ;
comment "//" ;
-entrypoints Stms, Exp ;
+entrypoints Program;