CST 8152 - Parsing - The Toy Language

This Toy Language contains the Toy Grammar for an assignment statement, plus the Print and Dump statements. We incorporate all three statement types into a new root non-terminal called <statement>:

<statement> -->
   ( <print> | <dump> | <assignment> ) ';'
<print> -->
   "print" <expression> ( ',' <expression> )*
<dump> -->
   "dump" ( <expression> ( ',' <expression> )* )?
<assignment> -->
   ID ‘=‘ <expression>
<expression> -->
   <term> ( ('+'|'-') <term> )*
<term> -->
   <factor> ( ('*'|'/') <factor> )*
<factor> -->
   ID | INT | STRING | '(' <expression> ')' | '-' <factor>