Package net.sf.tweety.logics.pl.parser
Class PlParser
- java.lang.Object
-
- net.sf.tweety.commons.Parser<PlBeliefSet,PlFormula>
-
- net.sf.tweety.logics.pl.parser.PlParser
-
public class PlParser extends net.sf.tweety.commons.Parser<PlBeliefSet,PlFormula>
This class implements a parser for propositional logic. The BNF for a propositional belief set is given by (starting symbol is FORMULASET)
FORMULASET ::== FORMULA ( "\n" FORMULA )*
FORMULA ::== PROPOSITION | "(" FORMULA ")" | FORMULA ">>" FORMULA | FORMULA "||" FORMULA | FORMULA "=>" FORMULA | FORMULA "<=>" FORMULA | "!" FORMULA | "+" | "-"
PROPOSITION is a sequence of characters excluding |,&,!,(,),=,<,> and whitespace characters.- Author:
- Matthias Thimm, Bastian Wolf
-
-
Constructor Summary
Constructors Constructor Description PlParser()
-
Method Summary
Modifier and Type Method Description PlBeliefSetparseBeliefBase(Reader reader)protected PlFormulaparseDisjunction(List<Object> l)Parses a simple formula as a list of String tokens or formulas into a propositional formula.PlFormulaparseFormula(Reader reader)
-
-
-
Method Detail
-
parseBeliefBase
public PlBeliefSet parseBeliefBase(Reader reader) throws net.sf.tweety.commons.ParserException
- Specified by:
parseBeliefBasein classnet.sf.tweety.commons.Parser<PlBeliefSet,PlFormula>- Throws:
net.sf.tweety.commons.ParserException
-
parseFormula
public PlFormula parseFormula(Reader reader) throws net.sf.tweety.commons.ParserException
- Specified by:
parseFormulain classnet.sf.tweety.commons.Parser<PlBeliefSet,PlFormula>- Throws:
net.sf.tweety.commons.ParserException
-
parseDisjunction
protected PlFormula parseDisjunction(List<Object> l) throws net.sf.tweety.commons.ParserException
Parses a simple formula as a list of String tokens or formulas into a propositional formula. This method expects no parentheses in the list and as such treats the formula as a disjunction.- Parameters:
l- a list objects, either String tokens or objects of type PropositionalFormula.- Returns:
- a propositional formula.
- Throws:
net.sf.tweety.commons.ParserException- if the list could not be parsed.
-
-