edu.udo.cs.ie.cowbots.elpParser
Class ElpParser

Package class diagram package ElpParser
java.lang.Object
  extended by edu.udo.cs.ie.cowbots.elpParser.ElpParser
All Implemented Interfaces:
ElpParserConstants

public class ElpParser
extends java.lang.Object
implements ElpParserConstants

The grammar of our extended logic program, namely the BNF is given and started by ANALYSE part. ELP ::== (elpExpr)* elpExpr ::== rule | constraint | fact rule ::== head + ":-" + body + "." constraint ::== ":-" + body + "." fact ::= literal + "." head ::= orLiteral | literal orLiteral ::= literal + "|"+ head body ::= andLiteral | opLiteral | ("not")? + literal opLiteral ::= (variable|constant) compOp (variable|constant) (arithOp (variable|constant))? andLiteral ::= ("not")? + ELPLiteral + "," + body literal ::= "~" + atom | atom atom ::= predicateName | predicateName + "(" + termList+ ")" termList ::= term | term + "," + termList term ::== variable | constant | list list ::== "[" ( ( term "|" variable ) | ( term ( "," term )* ) )? "]" predicateName is consisted of symbols from {[a,...,z][A,...,Z][0,...,9], _} with an uppercase letter at the beginning. variable is consisted of symbols from {[a,...,z][A,...,Z][0,...,9], _} with an uppercase letter at the beginning. constant is consisted of symbols from {[a,...,z][A,...,Z][0,...,9], _} with an lowercase letter at the beginning. compOp(comparative operator) is consisted of symbols from {"<", " >", "<=", " >=", "==", "!="}. arithOp(arithmetic operator) is consisted of symbols from {"+", "-", "*", "/", "%", "="}.


Field Summary
private static java.util.List<int[]> jj_expentries
           
private static int[] jj_expentry
           
private static int jj_gen
           
private static boolean jj_initialized_once
           
(package private) static SimpleCharStream jj_input_stream
           
private static int jj_kind
           
private static int[] jj_la1
           
private static int[] jj_la1_0
           
static Token jj_nt
          Next token.
private static int jj_ntk
           
static Token token
          Current token.
static ElpParserTokenManager token_source
          Generated Token Manager.
 
Fields inherited from interface edu.udo.cs.ie.cowbots.elpParser.ElpParserConstants
ARITHOP, CHAR, COMMA, COMPOP, DEFAULT, DIGIT, EOF, IMPLICATION, LETTER, LOWERCASE, LPAREN, NAF, NAME, NEG, NUMBER, OR, PERIOD, RPAREN, tokenImage, UPPERCASE
 
Constructor Summary
ElpParser(ElpParserTokenManager tm)
          Constructor with generated Token Manager.
ElpParser(java.io.InputStream stream)
          Constructor with InputStream.
ElpParser(java.io.InputStream stream, java.lang.String encoding)
          Constructor with InputStream and supplied encoding
ElpParser(java.io.Reader stream)
          Constructor.
 
Method Summary
static DisjunctiveLogicProgram analyse()
           
static DLPAtom atom(DisjunctiveLogicProgram dlp)
           
static void body(DisjunctiveLogicProgram dlp, DLPRule r)
           
static void disable_tracing()
          Disable tracing.
static void dlpExpr(DisjunctiveLogicProgram dlp)
           
static void enable_tracing()
          Enable tracing.
static ParseException generateParseException()
          Generate ParseException.
static Token getNextToken()
          Get the next Token.
static Token getToken(int index)
          Get the specific Token.
private static Token jj_consume_token(int kind)
           
private static void jj_la1_init_0()
           
private static int jj_ntk()
           
static DLPLiteral literal(DisjunctiveLogicProgram dlp)
           
static void main(java.lang.String[] args)
           
static DisjunctiveLogicProgram parse(java.lang.String fileName)
           
 void ReInit(ElpParserTokenManager tm)
          Reinitialise.
static void ReInit(java.io.InputStream stream)
          Reinitialise.
static void ReInit(java.io.InputStream stream, java.lang.String encoding)
          Reinitialise.
static void ReInit(java.io.Reader stream)
          Reinitialise.
static DLPTerm term(DisjunctiveLogicProgram dlp)
          TERM ::== VARIABLE | CONSTANT | LIST
static DLPTermList termList(DisjunctiveLogicProgram dlp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jj_initialized_once

private static boolean jj_initialized_once

token_source

public static ElpParserTokenManager token_source
Generated Token Manager.


jj_input_stream

static SimpleCharStream jj_input_stream

token

public static Token token
Current token.


jj_nt

public static Token jj_nt
Next token.


jj_ntk

private static int jj_ntk

jj_gen

private static int jj_gen

jj_la1

private static final int[] jj_la1

jj_la1_0

private static int[] jj_la1_0

jj_expentries

private static java.util.List<int[]> jj_expentries

jj_expentry

private static int[] jj_expentry

jj_kind

private static int jj_kind
Constructor Detail

ElpParser

public ElpParser(java.io.InputStream stream)
Constructor with InputStream.


ElpParser

public ElpParser(java.io.InputStream stream,
                 java.lang.String encoding)
Constructor with InputStream and supplied encoding


ElpParser

public ElpParser(java.io.Reader stream)
Constructor.


ElpParser

public ElpParser(ElpParserTokenManager tm)
Constructor with generated Token Manager.

Method Detail

parse

public static DisjunctiveLogicProgram parse(java.lang.String fileName)
                                     throws ParseException,
                                            java.io.FileNotFoundException
Throws:
ParseException
java.io.FileNotFoundException

main

public static void main(java.lang.String[] args)

analyse

public static final DisjunctiveLogicProgram analyse()
                                             throws ParseException
Throws:
ParseException

dlpExpr

public static final void dlpExpr(DisjunctiveLogicProgram dlp)
                          throws ParseException
Throws:
ParseException

body

public static final void body(DisjunctiveLogicProgram dlp,
                              DLPRule r)
                       throws ParseException
Throws:
ParseException

literal

public static final DLPLiteral literal(DisjunctiveLogicProgram dlp)
                                throws ParseException
Throws:
ParseException

atom

public static final DLPAtom atom(DisjunctiveLogicProgram dlp)
                          throws ParseException
Throws:
ParseException

termList

public static final DLPTermList termList(DisjunctiveLogicProgram dlp)
                                  throws ParseException
Throws:
ParseException

term

public static final DLPTerm term(DisjunctiveLogicProgram dlp)
                          throws ParseException
TERM ::== VARIABLE | CONSTANT | LIST

Throws:
ParseException

jj_la1_init_0

private static void jj_la1_init_0()

ReInit

public static void ReInit(java.io.InputStream stream)
Reinitialise.


ReInit

public static void ReInit(java.io.InputStream stream,
                          java.lang.String encoding)
Reinitialise.


ReInit

public static void ReInit(java.io.Reader stream)
Reinitialise.


ReInit

public void ReInit(ElpParserTokenManager tm)
Reinitialise.


jj_consume_token

private static Token jj_consume_token(int kind)
                               throws ParseException
Throws:
ParseException

getNextToken

public static final Token getNextToken()
Get the next Token.


getToken

public static final Token getToken(int index)
Get the specific Token.


jj_ntk

private static int jj_ntk()

generateParseException

public static ParseException generateParseException()
Generate ParseException.


enable_tracing

public static final void enable_tracing()
Enable tracing.


disable_tracing

public static final void disable_tracing()
Disable tracing.