<program> --> <func list>
<func list> --> empty | <func> <func list>
<func> --> <type name> ID left_parenthesis <parameter
list> right_parenthesis left_brace <data decls> <statements>
right_brace
<type name> --> int | int2 | void | int10
<parameter list> --> empty | <non-empty list>
<non-empty list> --> <type name> ID | <non-empty list>
comma <type name> ID
<data decls> --> empty | <type name> <id list> semicolon
<data decls>
<id list> ---> ID | <id list> comma ID
<block statements> --> left_brace <statements> right_brace
<statements> --> empty | <statement> <statements>
<statement> --> <assignment> | <func call> |
<if statement> | <while statement> | <return statement> | read
left_parenthesis ID right_parenthesis semicolon | write left_parenthesis
<expression>
right_parenthesis
semicolon
<assignment> --> ID equal_sign <expression> semicolon
<func call> --> ID left_parenthesis <expr list> right_parenthesis
semicolon
<expr list> --> empty | <non-empty expr list>
<non-empty expr list> --> <expression> | <expr list> comma
<expression>
<if statement> --> if <condition> <block statements>
<condition> --> left_parenthesis <expression> <comparison
op> <expression> right_parenthesis
<comparison op> --> == | != | > | >=
<while statement> --> while <condition> <block statements>
<return statement> --> return <expression> semicolon
<expression> --> <term> | <expression> <addop> <term>
<addop> --> plus_sign | minus_sign
<term> --> <factor> | <term> <mulop> <factor>
<mulop> --> star_sign | forward_slash
<factor> --> ID | ID left_parenthesis <expr
list> right_parenthesis | NUMBER | left_parenthesis
<expression> right_parenthesis
254 students: Do not need to compile <while
statement>. Can restrict functions to have only one argument instead of
a list of arguments. Can assume that comparison is always in the
format of
(ID | Number) <comparison op> (ID | Number)