University of Texas at El Paso
Banner
Compuer Science
   
Assignment 6 Minimize    

Compilers and Interpreters: Assignment 6

October 31, 2008

Make an ANTLR grammar for Mini-Triangle, as described in pages 8-9 of our textbook. As opposed to Assignment 5, you need to build an AST tree similar to the AST built in the Triangle parser (pages 109-110 of our textbook). This is done by building two grammars, one that parses the input and creates an AST tree. The other parses the AST tree and perform the necessary actions. For this assignments, the necessary actions are to output the level where a variable was declared each time a variable is used in an expression. The levels are defined as in figure 5.3, page 145 of our textbook.

Due Wednesday, November 12, before the start of class. Include "CS4352, assignment 6" on the subject line. E-mail to the instructor (longpre@utep.edu) and to the teaching assistant (nskanagala@gmail.com):

  1. the grammars.
  2. a sample Mini-Triangle program (perhaps the one from assignment 5) that causes the parser to execute all rules of the grammars.
  3. the output AST, as printed as printed by the "toStringTree" method
  4. the level of each variable as encountered in expressions.