Class CLawParser
- java.lang.Object
-
- net.sf.tweety.commons.Parser<CActionDescription,Formula>
-
- net.sf.tweety.action.description.parser.CLawParser
-
public class CLawParser extends Parser<CActionDescription,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
-
-
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 CActionDescription
parseBeliefBase(java.io.Reader reader)
Parses the given reader into a belief base of the given type.Formula
parseFormula(java.io.Reader reader)
Parses the given reader into a formula of the given type.Formula
parseFormula(java.lang.String s)
Parses the given text into a formula of the given type.-
Methods inherited from class net.sf.tweety.commons.Parser
isNumeric, parseBeliefBase, parseBeliefBaseFromFile, parseFormulaFromFile
-
-
-
-
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(java.io.Reader reader) throws ParserException
Description copied from class:Parser
Parses the given reader into a belief base of the given type.- Specified by:
parseBeliefBase
in classParser<CActionDescription,Formula>
- Parameters:
reader
- a reader- Returns:
- a belief base
- Throws:
ParserException
- some parsing exceptions may be added here.
-
parseFormula
public Formula parseFormula(java.io.Reader reader) throws java.io.IOException, ParserException
Description copied from class:Parser
Parses the given reader into a formula of the given type.- Specified by:
parseFormula
in classParser<CActionDescription,Formula>
- Parameters:
reader
- a reader- Returns:
- a formula
- Throws:
java.io.IOException
- if some IO issue occurred.ParserException
- some parsing exceptions may be added here.
-
parseFormula
public Formula parseFormula(java.lang.String s) throws ParserException, java.io.IOException
Description copied from class:Parser
Parses the given text into a formula of the given type.- Overrides:
parseFormula
in classParser<CActionDescription,Formula>
- Parameters:
s
- a string- Returns:
- a formula
- Throws:
ParserException
- some parsing exceptions may be added here.java.io.IOException
- if some IO issue occurred.
-
-