com.agentfactory.common.parser
Class Parser

java.lang.Object
  extended by com.agentfactory.common.parser.Parser

public class Parser
extends java.lang.Object

This class implements the core parse tree generation algorithm. The core algorithm is implemented in the parse() method, and the parser is configured by passing in:

Once parsed, a set of root nodes (one for each statement) can be retrieved by invoking the getProgram() method. TODO (Rem Collier): This class needs to be modified to include an error log for the parse tree generation process - currently, this is realised by printing the errors to the console.


Constructor Summary
Parser(Scanner scanner)
          Creates a new instance of Parser.
 
Method Summary
 java.util.List<Node> getProgram()
          Accessor that returns the root level nodes of the program.
 boolean parse()
          Implements the core parsing algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser(Scanner scanner)
Creates a new instance of Parser.

Parameters:
scanner - the syntax scanner
Method Detail

parse

public boolean parse()
Implements the core parsing algorithm.

Returns:
true if the parse tree was successfully generated, or false otherwise.

getProgram

public java.util.List<Node> getProgram()
Accessor that returns the root level nodes of the program.

Returns:
a list of root level nodes.