org.deri.iris.compiler
Class Parser

java.lang.Object
  extended by org.deri.iris.compiler.Parser

public class Parser
extends Object

Parses a datalog program in human readable form in to an IRIS object model.


Constructor Summary
Parser()
          Default constructor.
Parser(BuiltinRegister builtinRegister)
          Constructor for custom BuitinRegister.
 
Method Summary
 BuiltinRegister getBuiltinRegister()
          Get the built-in register instance for adding or removing built-ins.
 Map<IPredicate,IRelation> getFacts()
           
 List<IQuery> getQueries()
           
 List<IRule> getRules()
           
 void parse(Reader r)
          Parses a datalog string.
 void parse(String program)
          Parses a datalog program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser()
Default constructor. Uses a default BuiltinRegister.


Parser

public Parser(BuiltinRegister builtinRegister)
Constructor for custom BuitinRegister.

Parameters:
builtinRegister - The built-in register to use.
Method Detail

getBuiltinRegister

public BuiltinRegister getBuiltinRegister()
Get the built-in register instance for adding or removing built-ins.

Returns:
The built-in register instance

parse

public void parse(String program)
           throws ParserException
Parses a datalog program.

Parameters:
program - The program to parse. This must not be null.
Throws:
ParserException

getRules

public List<IRule> getRules()

getFacts

public Map<IPredicate,IRelation> getFacts()

getQueries

public List<IQuery> getQueries()

parse

public void parse(Reader r)
           throws ParserException
Parses a datalog string. The parsed object will be add to the submitted program.

Parameters:
r - the reader from where to read the program
p - the program where to add the objects. Might be null
Throws:
ParserException - if something went wrong while parsing
IllegalArgumentException - if the reader is null