Package compilation.analysis.syntax
Class ParseTree
- java.lang.Object
-
- compilation.analysis.syntax.ParseTree
-
public final class ParseTree extends java.lang.ObjectThe ParseTree class is used to hold the root Statement generated by the Parser.When the Parser creates a series of Statement objects, the root is held here in the form of a ParseTree. Typically, this will be SourceStatement object, but any child of the Statement interface is valid.
- Since:
- 1.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StatementgetStatement()Returns the root Statement object initially stored when the ParseTree was constructed.static voidprint()Pretty prints the ParseTree to the console.
-
-
-
Constructor Detail
-
ParseTree
public ParseTree(Statement statement)
Constructs a ParseTree object for storing a Statement object.A static copy of the Statement is also saved on initialisation, so that it can be printed later on.
- Parameters:
statement- The Statement root object to be stored
-
-
Method Detail
-
getStatement
public Statement getStatement()
Returns the root Statement object initially stored when the ParseTree was constructed.- Returns:
- The root Statement object
-
print
public static void print()
Pretty prints the ParseTree to the console.
-
-