TInt. Type ::= "int" ;
TBool. Type ::= "bool" ;
-Program. Stms ::= [Stm] ;
+Program. Program ::= [FuncStm] ;
SExp. Stm ::= Exp ";" ;
SBlock. Stm ::= "{" [Stm] "}" ;
-declIntE. Stm ::= "int" Ident "=" Exp ";" ;
-declBoolE. Stm ::= "bool" Ident "=" Exp ";" ;
-define declIntE x e = SDecl TInt x e;
-define declBoolE x e = SDecl TBool x e;
-declInt. Stm ::= "int" Ident ";" ;
-declBool. Stm ::= "bool" Ident ";" ;
-define declInt x = SDecl TInt x (EInt 0);
-define declBool x = SDecl TBool x (EBool False);
+SDecl. Stm ::= Type Ident "=" Exp ";" ;
+SDeclD. Stm ::= Type Ident ";" ;
SWhile. Stm ::= "while" "(" Exp ")" 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 ::= "<=" ;
internal EPost. Exp ::= Ident Op1 ;
internal SNoop. Stm ::= ;
-internal SDecl. Stm ::= Type Ident "=" Exp ";" ;
comment "/*" "*/" ;
comment "//" ;
-entrypoints Stms, Exp ;
+entrypoints Program;