Milestone 10 - Level B Compiling
Objective
The objective of this assignment is the construction of your compiler for level B compliance. Again, by the time this milestone is due you should have all of level C and all, or at least most, of level B compiling done if you are targeting an A level compiler.
To Do
The first thing to do is mark up with action symbols the section of the mPascal grammar that you identify as necessary for level B compliance. The action symbols you insert should also show which semantic records are needed to accomplish the action. Bring your compiler up to level B compliance. This means that you are to generate IR that can be run through the mMachine emulator for any mPascal program consisting of just a main program with Read, Write, assignment, and all control statements. Your compiler is to follow the standard approach of using semantic records and semantic actions (methods in the Analyzer object) for symbol table management and IR code generation. In summary, your compiler should now be capable of:
- Compiling programs that consist of just a main program.
- Full symbol table functionality
- Compiling read statements
- Compiling write statements
- Compiling assignment statements
- Compiling control structures.
In other words, your compiler should parse any valid mPascal program and compile any valid mPascal program that consists of just a main program.
Special Note
Note the following:
- Level C compliance does not require handling Boolean expressions, but level B does, because level B entails the compilation of the various control statements, such as ifs and loops..
- You must represent Boolean values internally as 0 for FALSE and 1 for True.
- Booleans are not treated the same in Pascal as in, for example, C. You cannot allow an integer result where a Boolean value is expected, and vice versa. For instance, the statement
-
If A + B then write(A) else Write(B);
-
To Turn In
- There is nothing to turn in this week. Your project will be due at the due date for level A compliance, at which point it will be tested for all levels of compliance.