CpSc 423, Language Processor Techniques

Assignment 2

due April 22

Parser

In this second project, you will write a parser for the language that you tokenized in Assignment 1.

As with the first assignment, the parser should take an input filename on the command line (e.g., parse filename). If there is an error in the input, your program should write an informative error message (including a description of the error and the line number on which it occurred) to its standard error stream and exit.

If the input file is syntactically correct, your program should dump the contents of its symbol table to standard output.

Semantic Checking

In addition to syntax checking, your program should report the use of undeclared variables as an error. Also check that the MODULE declaration and the beginning of the program and the END statement at the end of the program use the same identifier.