Program   ::= module Id ; Block Id .
Block     ::= DeclList begin StmtList end
DeclList  ::= { Decl ; }
Decl      ::= ConstDecl | ProcDecl | VarDecl
ConstDecl ::= const ConstDeclItem { , ConstDeclItem }
ConstDeclItem ::= Id : Type = ConstExpr
ConstExpr ::= Id | Integer
VarDecl   ::= var VarDeclItem { , VarDeclItem }
VarDeclItem ::= Id : Type
ProcDecl  ::= procedure Id ([ FormalDecl {, FormalDecl} ] ) ; Block Id
FormalDecl::= Id : Type
Type      ::= int
StmtList  ::= { Stmt ; }
Stmt      ::= CallStmt | AssignStmt | OutStmt | IfStmt | WhileStmt
CallStmt  ::= Id ( [ Exprs ] )
AssignStmt::= Lvalue := Expr
Lvalue    ::= Id
OutStmt   ::= output := Expr
IfStmt    ::= if Test then StmtList end
WhileStmt ::= while Test do StmtList end
Test      ::= odd Sum | Sum Relop Sum
Relop     ::= <= | <> | < | >= | > | =
Exprs     ::= Expr {, Expr }
Expr      ::= Sum
Sum       ::= Term { (+ | -) Term }
Term      ::= Factor { (* | /) Factor }
Factor    ::= - Factor | LValue | Integer | input | ( Expr )