Generic Interpreter 0.9
Protected API

gi
Class Grammar.ParseTree

java.lang.Object
  |
  +--gi.Grammar.ParseTree
Enclosing class:
Grammar

protected static class Grammar.ParseTree
extends Object

This class implements a ParseTree constructed by interpreting a source stream.

Version:
0.9
Author:
© 1999-2000 Craig A. Rich <carich@acm.org>

Field Summary
 Object attribute
          The attribute at the root of this ParseTree.
 Grammar.ParseTree[] phrase
          The subtrees of the root of this ParseTree.
 Object symbol
          The symbol at the root of this ParseTree.
 
Method Summary
 String toString()
          Returns a string representation of this ParseTree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

attribute

public Object attribute

The attribute at the root of this ParseTree. If symbol is a terminal, attribute is initially the source word symbol matches; otherwise, attribute is initially null. attribute may be modified when interpreting by evaluation of embedded Semantics.


phrase

public Grammar.ParseTree[] phrase

The subtrees of the root of this ParseTree. If symbol is a nonterminal, phrase is the array of subtrees produced by symbol; otherwise, phrase is null.


symbol

public Object symbol

The symbol at the root of this ParseTree. symbol can be a nonterminal, a terminal or Semantics.

Method Detail

toString

public String toString()

Returns a string representation of this ParseTree. The symbols in the ParseTree are shown in outline form, with children below their parent indented two columns. Each symbol is followed by its attribute value, if it is not null and differs from the symbol.

Overrides:
toString in class Object
Returns:
the string representation of this ParseTree.

 

© 1999-2000 Craig A. Rich <carich@acm.org>