
This language has the following properties: not case sensitive must have white space (blank characters, tab characters, and end of line characters) between every lexeme The interpreter will parse a program in this language and build some intermediate data structures.
These data structures will then be interpreted to execute the program.
The parsing algorithm should detect any syntactical or semantic error. The first such error discovered should cause an appropriate error message to be printed, and then the interpreter should abort. Run-time errors should also be detected with appropriate error messages being printed.
<pre class="prettyprint prettyprinted" style=""> </pre> <program> → program id <compound_statement> <statement> → <if_statement> | <assignment_statement> | <while_statement> | <print_statement> | <compound_statement> <compound_statement> → begin <statement_list> end <statement_list> → <statement> | <statement> ; <statement_list> <if_statement> → if <boolean_expression> then <statement> else <statement> <while_statement> → while <boolean_expression> do <statement> <assignment_statement> -> id := <arithmetic_expression> <print_statement> → print id <boolean_expression> → <operand> <relative_op> <operand> <operand> → id | constant <relative_op> → < | <= | > | >= | = | /= <arithmetic_expression> → <operand> | <operand> <arithmetic_op> <operand> <arithmetic_op> → + | - | * | /
EmoticonEmoticon