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
Fields inherited from interface org.tweetyproject.arg.delp.parser.DelpParserConstants
DEFAULT, EOF, NAME, QUOTED, tokenImage
-
Constructor Summary
ConstructorDescriptionDelpParser
(InputStream stream) DelpParser
(InputStream stream, String encoding) DelpParser
(Reader stream) -
Method Summary
Modifier and TypeMethodDescriptionfinal FolAtom
Atom
(DefeasibleLogicProgram delp, FolSignature signature) final void
final void
final void
Expression
(DefeasibleLogicProgram delp, FolSignature signature) final FolFormula
Formula
(FolSignature signature) final Token
final Token
getToken
(int index) final FolFormula
Literal
(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.void
ReInit
(InputStream stream) void
ReInit
(InputStream stream, String encoding) void
void
final Term
Term
(DefeasibleLogicProgram delp, FolSignature signature) final DefeasibleLogicProgram
Theory
(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:Parser
Parses the given reader into a belief base of the given type.- Specified by:
parseBeliefBase
in 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:Parser
Parses the given reader into a formula of the given type.- Specified by:
parseFormula
in 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()
-