Class 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 "^^" FORMULA | "!" FORMULA | "+" | "-"

    PROPOSITION is a sequence of characters excluding |,&,!,(,),=,<,> and whitespace characters.
    Author:
    Matthias Thimm, Bastian Wolf
    • Constructor Detail

      • PlParser

        public PlParser()
    • Method Detail

      • parseBeliefBase

        public PlBeliefSet parseBeliefBase​(Reader reader)
                                    throws net.sf.tweety.commons.ParserException
        Specified by:
        parseBeliefBase in class net.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:
        parseFormula in class net.sf.tweety.commons.Parser<PlBeliefSet,​PlFormula>
        Throws:
        net.sf.tweety.commons.ParserException
      • parseExclusiveDisjunction

        protected PlFormula parseExclusiveDisjunction​(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.
      • 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.