program : block

block : declarations compound_statement

declarations : ('var' (variable_declaration SEMI)+)*
                | ('function' ID (LPAREN formal_parameter_list RPAREN)? OPEN block CLOSE)*
                | empty

variable_declarations : ID (COMMA ID)* COLON type_spec

type_spec: INTEGER

formal_parameter_list : formal_parameters
                | formal_parameters SEMI formal_parameter_list

formal_parameters : ID (COMMA ID)* COLON type_spec

compound_statement : statement_list

statement_list : statement
               | statement SEMI statement_list

statement : compound_statement
          | assignment_statement
          | empty

assignment_statement : variable ASSIGN expr

empty :

expr: term ((PLUS | MINUS) term)*

term: factor ((MULTIPLY | DIVIDE) factor)*

factor : PLUS factor
       | MINUS factor
       | INTEGER
       | LPAREN expr RPAREN
       | variable

variable: ID

program : block

block : declarations compound_statement

declarations : ('var' (variable_declaration SEMI)+)*
                | ('function' ID (LPAREN formal_parameter_list RPAREN)? OPEN block CLOSE)*
                | empty

variable_declarations : ID (COMMA ID)* COLON type_spec

type_spec: 'int' | 'str'

formal_parameter_list : formal_parameters
                | formal_parameters SEMI formal_parameter_list

formal_parameters : ID (COMMA ID)* COLON type_spec

compound_statement : statement_list

statement_list : statement
               | statement SEMI statement_list

statement : compound_statement
          | assignment_statement
          | empty

assignment_statement : variable ASSIGN expr

empty :

expr: term ((PLUS | MINUS) term)*

term: factor ((MULTIPLY | DIVIDE) factor)*

factor : PLUS factor
       | MINUS factor
       | 'int'
       | LPAREN expr RPAREN
       | variable

variable: ID

Change 'INTEGER' to 'int' in one more place.
Change 'INTEGER' to 'int' in one more place.
