University of Toronto
CSC467F Compilers and Interpreters Fall 2005

Output Format for Abstract Syntax Tree

The representation of the abstract syntax tree will have the following format:

where Name corresponds to the LHS of a grammar rule (a node in the AST), the optional description contains some (usually semantic) information about Name contained between round brackets '(' and ')', and Argument 1, Argument 2, etc. are symbols on the RHS of the rule (children of the node) which have non-trivial content. Descent through the tree is represented by indentation (exactly 1 tab per level), and ascent by removal of indentation.

The grammar productions which will be in the representation are given below. You can use these as an indication of what kind of data structure the nodes of your tree will be made of, but they are not meant to be any restriction on your implementation of the actual AST.

Notes on the representation:


**PARTICULAR STATEMENTS** * Declarations and Statements can both be followed by the modifier (none), in which case no list of particular declarations and/or statements follow. * If either the elseif or else part is missing it should be omitted; (none) refers to the situation when the elseif condition is present but there are no actual statements following the then keyword. **PARTICULAR EXPRESSIONS** **PARTICULAR DECLARATIONS AND PARAMETERS** **PARTICULAR OUTPUTS** **PARTICULAR INPUTS**
Frank Van Bussel
Last modified October, 2005