Project3: Parse Tree Output Format For SL Programs


This is an explanation of the format of the sample parse trees given along with the assignment.

In theory, the leaf nodes of a parse tree include every input token. In practice, many input tokens are redundant and can be omitted. Similarly, the redundant internal (non-terminal) nodes may also be omitted. Such nodes do not contribute to interpretations or execution. (See the class notes on parsing.)

In SL, we need not have explicit nodes in the parse tree for most delimiters, keywords, and even some non terminals. Terminals (tokens) and non terminals that are typically omitted from the parse tree are:
    (  )  {  }  ;  ,  =
    function call break if else let read write return while
    PARAMLIST PARAMREST STATEMENT ARGLIST ARGREST BINOP UNOP
Here are some explanatory notes, though not comprehensive, on the parse tree output for some of the more confusing situations.

The tree output format for the remaining should be fairly obvious from the given examples.
Ravishankar Mosur
Last modified: Wed Mar 18 10:03:54 EST 1998