In this assignment, you will implement the semantic analysis phase of the WLP4
compiler for which you wrote a scanner and a parser in previous assignments. In
particular, it is the job of this assignment to catch all remaining compile-time
errors in the source program; a program that makes it through this phase of
compilation is guaranteed to be free of compile-time errors.
The specific semantic rules that must be enforced are those outlined in the
“Context-sensitive Syntax” section of the WLP4 Specification (see WLP4
Specification.pdf). A summary of the semantic rules of WLP4 (see Semantic
Rules.pdf) related to types is available for download. The summary contains formal
descriptions of type rules for WLP4; although these should match the English
descriptions on the WLP4 specification page, the WLP4 specification should be
considered the definitive resource. Please report any discrepancies between the two
To test your semantic analyzer, you will need .wlp4i files (see WLP4I Format.pdf).
You can use the parser that we have provided.
Although the inputs for this assignment are WLP4I files, TestingSystem will not
show you WLP4I files in the test results because they are large and hard to read.
TestingSystem will show you WLP4 source code. You will have to run the WLP4
programs TestingSystem shows you through wlp4scan and wlp4parse to produce
WLP4I files that you can test with, as explained above.
While the problems have different output requirements, the TestingSystem tests are
designed so that the same code can be submitted to all problems, without needing
to remove or comment out certain parts.
For all problems where you have to output symbol tables, TestingSystem will
ignore extra whitespace at the end of lines (for example if you have extra spaces
before the end of a line). However, it will not ignore all extra whitespace; for
example, extra newlines that are not supposed to be part of the output might cause
you to fail tests. Every line should be terminated with a newline character, but
there should be no additional newlines.