University of Texas at El Paso
Compuer Science
Assignment 4 Minimize    

Compilers and Interpreters: Assignment 4

October 6, 2008

Modify the Triangle compiler to allow for statements. The syntax of the statement is as follows:

for-Statement ::= for ( single-Command , Expression , single-Command ) single-Command

We have not seen code generation yet, so in this assignment, the for statements will be checked for syntax, but will not generate any code. To do this assignment, you will need to write code to parse the for statements, generate ASTs for the statements, insert a stub methods that do nothing, but that are called when the code generation phase of the compiler encounters the new statement node in the AST.

Due Wednesday, October 15, at the start of class. E-mail to the instructor ( and to the teaching assistant (

  1. the files from the compiler that were modified.
  2. two test triangle programs, one with a syntax error in the for loop, and one with no syntax error.