Class CLawParser
- java.lang.Object
-
- net.sf.tweety.commons.Parser<CActionDescription,net.sf.tweety.commons.Formula>
-
- net.sf.tweety.action.description.parser.CLawParser
-
public class CLawParser extends net.sf.tweety.commons.Parser<CActionDescription,net.sf.tweety.commons.Formula>
This class implements a parser for causal laws in C. The BNF of such rules is given by: (starting symbol is DESC)
DESC ::== LAW ("\n" LAW)*
LAW ::== STATICLAW | DYNAMICLAW
STATICLAW ::== "caused" FOLFORMULA ("if" FOLFORMULA)? ("requires" REQUIREMENTS)?
DYNAMICLAW ::== "caused" FOLFORMULA ("if" FOLFORMULA)? "after" FOLFORMULA ("requires" REQUIREMENTS)?
REQUIREMENTS ::== REQUIREMENT ("," REQUIREMENT)*
REQUIREMENT ::== (VARIABLENAME "<>" VARIABLENAME | VARIABLENAME "<>" CONSTANTNAME)*
where FOLFORMULA is an unquantified first-order formula without functors,
and VARIABLENAME, CONSTANTNAME are sequences of symbols
from {a,...,z,A,...,Z,0,...,9} with a letter at the beginning.- Author:
- Sebastian Homann
-
-
Field Summary
Fields Modifier and Type Field Description protected ActionSignaturesignature
-
Constructor Summary
Constructors Constructor Description CLawParser(ActionSignature signature)This parser needs a valid action signature to parse causal laws.
-
Method Summary
Modifier and Type Method Description protected Set<String>containedKeywords(String s)Returns the set of forbidden keywords, that are contained in a string.CActionDescriptionparseBeliefBase(Reader reader)protected net.sf.tweety.logics.fol.syntax.FolFormulaparseFolFormula(String s)Parses a FolFormula from a string using the FolParser classnet.sf.tweety.commons.FormulaparseFormula(Reader reader)net.sf.tweety.commons.FormulaparseFormula(String s)
-
-
-
Field Detail
-
signature
protected ActionSignature signature
-
-
Constructor Detail
-
CLawParser
public CLawParser(ActionSignature signature)
This parser needs a valid action signature to parse causal laws.- Parameters:
signature- some signature
-
-
Method Detail
-
parseBeliefBase
public CActionDescription parseBeliefBase(Reader reader) throws net.sf.tweety.commons.ParserException
- Specified by:
parseBeliefBasein classnet.sf.tweety.commons.Parser<CActionDescription,net.sf.tweety.commons.Formula>- Throws:
net.sf.tweety.commons.ParserException
-
parseFormula
public net.sf.tweety.commons.Formula parseFormula(Reader reader) throws IOException, net.sf.tweety.commons.ParserException
- Specified by:
parseFormulain classnet.sf.tweety.commons.Parser<CActionDescription,net.sf.tweety.commons.Formula>- Throws:
IOExceptionnet.sf.tweety.commons.ParserException
-
parseFolFormula
protected net.sf.tweety.logics.fol.syntax.FolFormula parseFolFormula(String s) throws net.sf.tweety.commons.ParserException, IOException
Parses a FolFormula from a string using the FolParser class- Parameters:
s- a string- Returns:
- A first order formula
- Throws:
net.sf.tweety.commons.ParserException- if parsing failsIOException- if an IO issue occurs.
-
parseFormula
public net.sf.tweety.commons.Formula parseFormula(String s) throws net.sf.tweety.commons.ParserException, IOException
- Overrides:
parseFormulain classnet.sf.tweety.commons.Parser<CActionDescription,net.sf.tweety.commons.Formula>- Throws:
net.sf.tweety.commons.ParserExceptionIOException
-
-