Class DelpParser
java.lang.Object
org.tweetyproject.commons.Parser<DefeasibleLogicProgram,Formula>
org.tweetyproject.arg.delp.parser.DelpParser
- All Implemented Interfaces:
DelpParserConstants
public class DelpParser
extends Parser<DefeasibleLogicProgram,Formula>
implements DelpParserConstants
This class implements a parser for defeasible logic programs. The BNF for defeasible
logic program files is given by (start symbol is THEORY)
THEORY ::== (EXPRESSION)+
EXPRESSION ::== FACT | STRICTRULE | DEFEASIBLERULE
FACT ::== LITERAL + "."
STRICTRULE ::== LITERAL + "<-" + RULEBODY + "."
DEFEASIBLERULE ::== LITERAL + "-<" + RULEBODY + "."
RULEBODY ::== LITERAL | LITERAL + "," + RULEBODY
LITERAL ::== "~" + ATOM | ATOM
ATOM ::== PREDICATE | PREDICATE + "(" + TERMLIST + ")"
TERMLIST ::== TERM | TERM + "," + TERMLIST
TERM ::== VARIABLE | CONSTANT | QUOTED_STRING
PREDICATE is a sequence of symbols from {a,...,z,A,...,Z,0,...,9,_,-} with a letter at the beginning.
VARIABLE is a sequence of symbols from {a,...,z,A,...,Z,0,...,9,_,-} with an uppercase letter at the beginning.
CONSTANT is a sequence of symbols from {a,...,z,A,...,Z,0,...,9,_,-} with an lowercase letter at the beginning.
QUOTED_STRING is all characters between double quotes.
-
Field Summary
FieldsFields inherited from interface org.tweetyproject.arg.delp.parser.DelpParserConstants
DEFAULT, EOF, NAME, QUOTED, tokenImage -
Constructor Summary
ConstructorsConstructorDescriptionDelpParser(InputStream stream) DelpParser(InputStream stream, String encoding) DelpParser(Reader stream) -
Method Summary
Modifier and TypeMethodDescriptionfinal FolAtomAtom(DefeasibleLogicProgram delp, FolSignature signature) final voidfinal voidfinal voidExpression(DefeasibleLogicProgram delp, FolSignature signature) final FolFormulaFormula(FolSignature signature) final Tokenfinal TokengetToken(int index) final FolFormulaLiteral(DefeasibleLogicProgram delp, FolSignature signature) parseBeliefBase(Reader reader) Parses the given reader into a belief base of the given type.parseFormula(Reader reader) Parses the given reader into a formula of the given type.voidReInit(InputStream stream) voidReInit(InputStream stream, String encoding) voidvoidfinal TermTerm(DefeasibleLogicProgram delp, FolSignature signature) final DefeasibleLogicProgramTheory(FolSignature signature) Methods inherited from class org.tweetyproject.commons.Parser
isNumeric, parseBeliefBase, parseBeliefBaseFromFile, parseFormula, parseFormulaFromFile, parseListOfBeliefBases, parseListOfBeliefBases, parseListOfBeliefBasesFromFile, parseListOfBeliefBasesFromFile
-
Field Details
-
token_source
-
token
-
jj_nt
-
-
Constructor Details
-
DelpParser
public DelpParser() -
DelpParser
-
DelpParser
-
DelpParser
-
DelpParser
-
-
Method Details
-
parseBeliefBase
Description copied from class:ParserParses the given reader into a belief base of the given type.- Specified by:
parseBeliefBasein classParser<DefeasibleLogicProgram,Formula> - Parameters:
reader- a reader- Returns:
- a belief base
- Throws:
ParserException- some parsing exceptions may be added here.
-
parseFormula
Description copied from class:ParserParses the given reader into a formula of the given type.- Specified by:
parseFormulain classParser<DefeasibleLogicProgram,Formula> - Parameters:
reader- a reader- Returns:
- a formula
- Throws:
ParserException- some parsing exceptions may be added here.
-
getSignature
-
Theory
- Throws:
ParseException
-
Expression
public final void Expression(DefeasibleLogicProgram delp, FolSignature signature) throws ParseException - Throws:
ParseException
-
Formula
- Throws:
ParseException
-
Literal
public final FolFormula Literal(DefeasibleLogicProgram delp, FolSignature signature) throws ParseException - Throws:
ParseException
-
Atom
public final FolAtom Atom(DefeasibleLogicProgram delp, FolSignature signature) throws ParseException - Throws:
ParseException
-
Term
- Throws:
ParseException
-
ReInit
-
ReInit
-
ReInit
-
ReInit
-
getNextToken
-
getToken
-
generateParseException
-
enable_tracing
public final void enable_tracing() -
disable_tracing
public final void disable_tracing()
-