public class FolParser extends Parser<FolBeliefSet>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
EXISTS_QUANTIFIER
exists-quantifier used in syntax
|
static java.lang.String |
FORALL_QUANTIFIER
forall-quantifier used in syntax
|
private FolSignature |
signature
Keeps track of the signature.
|
private java.util.Map<java.lang.String,Variable> |
variables
Keeps track of variables defined.
|
| Constructor and Description |
|---|
FolParser() |
| Modifier and Type | Method and Description |
|---|---|
private void |
consumeToken(java.util.Stack<java.lang.Object> stack,
int c)
This method reads one token from the given reader and appropriately
constructs a fol formula from the stream.
|
FolSignature |
getSignature()
Returns the signature of this parser.
|
private FolFormula |
parseAtomic(java.util.List<java.lang.Object> l)
Parses a simple formula as a list of String tokens or formulas into a fol formula.
|
FolBeliefSet |
parseBeliefBase(java.io.Reader reader)
Parses the given reader into a belief base of the given type.
|
private FolFormula |
parseConjunction(java.util.List<java.lang.Object> l)
Parses a simple conjunction as a list of String tokens or formulas into a fol formula.
|
private FolFormula |
parseDisjunction(java.util.List<java.lang.Object> l)
Parses a disjunction as a list of String tokens or formulas into a fol formula.
|
Formula |
parseFormula(java.io.Reader reader)
Parses the given reader into a formula of the given type.
|
private FolFormula |
parseNegation(java.util.List<java.lang.Object> l)
Parses a simple formula as a list of String tokens or formulas into a fol formula.
|
private FolFormula |
parseQuantification(java.util.List<java.lang.Object> l)
Parses a quantified formula as a list of String tokens or formulas.
|
void |
parseSortDeclaration(java.lang.String s,
FolSignature sig)
Parses a sort declaration of the form "SORTNAME "=" "{" (CONSTANTNAME ("," CONSTANTNAME)*)? "}""
and modifies the given signature accordingly.
|
private java.util.List<Term<?>> |
parseTermlist(java.util.List<java.lang.Object> l)
Parses a term list as a list of String tokens or terms into a list of terms.
|
void |
parseTypeDeclaration(java.lang.String s,
FolSignature sig)
Parses a predicate declaration of the form "type" "(" PREDICATENAME "(" (SORTNAME ("," SORTNAME)*)? ")" ")"
or a functor declaration of the form "type" "(" SORTNAME "=" FUNCTORNAME "(" (SORTNAME ("," SORTNAME)*)? ")" ")"
and modifies the given signature accordingly.
|
void |
setSignature(FolSignature signature)
Sets the signature for this parser.
|
isNumeric, parseBeliefBase, parseBeliefBaseFromFile, parseFormula, parseFormulaFromFilepublic static final java.lang.String FORALL_QUANTIFIER
public static final java.lang.String EXISTS_QUANTIFIER
private FolSignature signature
private java.util.Map<java.lang.String,Variable> variables
public FolBeliefSet parseBeliefBase(java.io.Reader reader) throws java.io.IOException, ParserException
ParserparseBeliefBase in class Parser<FolBeliefSet>reader - a readerjava.io.IOExceptionParserExceptionpublic void parseSortDeclaration(java.lang.String s,
FolSignature sig)
throws ParserException
s - a stringsig - a signatureParserExceptionpublic void parseTypeDeclaration(java.lang.String s,
FolSignature sig)
throws ParserException
s - a stringsig - a signatureParserExceptionpublic Formula parseFormula(java.io.Reader reader) throws java.io.IOException, ParserException
ParserparseFormula in class Parser<FolBeliefSet>reader - a readerjava.io.IOExceptionParserExceptionprivate void consumeToken(java.util.Stack<java.lang.Object> stack,
int c)
throws ParserException
stack - a stack used for monitoring the read items.c - a token from a stream.ParserException - in case of parser errors.private java.util.List<Term<?>> parseTermlist(java.util.List<java.lang.Object> l) throws ParserException
l - a list objects, either String tokens or objects of type List.ParserException - if the list could not be parsed.private FolFormula parseQuantification(java.util.List<java.lang.Object> l) throws ParserException
l - a list objects, either String tokens or objects of type FolFormula.ParserException - if the list could not be parsed.private FolFormula parseDisjunction(java.util.List<java.lang.Object> l)
l - a list objects, either String tokens or objects of type FolFormula.ParserException - if the list could not be parsed.private FolFormula parseConjunction(java.util.List<java.lang.Object> l) throws ParserException
l - a list objects, either String tokens or objects of type FolFormula.ParserException - if the list could not be parsed.private FolFormula parseNegation(java.util.List<java.lang.Object> l) throws ParserException
l - a list objects, either String tokens or objects of type FolFormula.ParserException - if the list could not be parsed.private FolFormula parseAtomic(java.util.List<java.lang.Object> l) throws ParserException
l - a list objects, either String tokens or objects of type folFormula.ParserExceptionpublic void setSignature(FolSignature signature)
signature - a fol signature.public FolSignature getSignature()