CS 3723/3721 Programming Languages
Tiny Compiler 3: Semantic Actions --
Translation of while and if-then-else


Overview: This recitation extends the previous one to translate while, if-then-else and input statement, as well as the previous ones. You need to add extra code to your parser to translate these additional constructs.

You will now be using the full grammar from Recitation 5. (Below the part in bold red type is what needs to be implemented for this recitation.)

Translation of Constructs: One mainly has to decide how to translate each construct into MIPS assembly language (in a way consistent with the previous recitation).

What to turn in: You could process one of the two source programs given in the recitation about recursive descent parsing:

which should produce the output: here, or

which should produce the output: here

Key ideas: One adds semantic actions to a parser to create a translator.


Revision date: 2003-03-04. (Use ISO 8601, an International Standard.)