Class QCirParser
java.lang.Object
org.tweetyproject.commons.Parser<PlBeliefSet,PlFormula>
org.tweetyproject.logics.qbf.parser.QCirParser
This class implements a parser for the QCIR (Quantified CIRcuit) format. See
http://www.qbflib.org/qcir.pdf for more information.
The BNF for a QCir file is given by (starting symbol is QCIR-FILE):
QCIR-FILE ::== FORMAT-ID QBLOCK-STMT OUTPUT-STMT (GATE-STMT)*
FORMAT-ID ::== "#QCIR-G14" [INTEGER] "\n"
QBLOCK-STMT ::== ["free(" VAR-LIST ")\n"] QBLOCK-QUANT*
QBLOCK-QUANT ::== QUANT "(" VAR-LIST ")"\n"
VAR-LIST ::== (VAR,)* VAR
LIT-LIST ::== (LIT,)* LIT
OUTPUT-STMT ::== "output(" LIT ")\n"
GATE-STMT ::== GVAR "=" "and" "(" LIT-LIST ")" | GVAR "=" "or" "(" LIT-LIST ")" | GVAR "=" "xor(" LIT "," LIT ")" | GVAR "=" "ite(" LIT "," LIT "," LIT ")" | GVAR = QUANT "(" VAR-LIST ";" LIT ")"
QUANT ::== "exists" | "forall"
LIT ::== VAR | "-" VAR | GVAR | "-" GVAR
ite stands for if-then-else.
INTEGER are integer numbers.
VAR and GVAR are sequences of characters of symbols from {a,...,z,A,...,Z,0,...,9,_}.
Additionally, lines starting with "#" (comments) will be ignored.
The BNF for a QCir file is given by (starting symbol is QCIR-FILE):
QCIR-FILE ::== FORMAT-ID QBLOCK-STMT OUTPUT-STMT (GATE-STMT)*
FORMAT-ID ::== "#QCIR-G14" [INTEGER] "\n"
QBLOCK-STMT ::== ["free(" VAR-LIST ")\n"] QBLOCK-QUANT*
QBLOCK-QUANT ::== QUANT "(" VAR-LIST ")"\n"
VAR-LIST ::== (VAR,)* VAR
LIT-LIST ::== (LIT,)* LIT
OUTPUT-STMT ::== "output(" LIT ")\n"
GATE-STMT ::== GVAR "=" "and" "(" LIT-LIST ")" | GVAR "=" "or" "(" LIT-LIST ")" | GVAR "=" "xor(" LIT "," LIT ")" | GVAR "=" "ite(" LIT "," LIT "," LIT ")" | GVAR = QUANT "(" VAR-LIST ";" LIT ")"
QUANT ::== "exists" | "forall"
LIT ::== VAR | "-" VAR | GVAR | "-" GVAR
ite stands for if-then-else.
INTEGER are integer numbers.
VAR and GVAR are sequences of characters of symbols from {a,...,z,A,...,Z,0,...,9,_}.
Additionally, lines starting with "#" (comments) will be ignored.
- Author:
- Anna Gessler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the output gate of this QCir problem.parseBeliefBase
(Reader reader) Parses the given reader into a belief base of the given type.parseFormula
(Reader reader) Parses the given reader into a formula of the given type.Methods inherited from class org.tweetyproject.commons.Parser
isNumeric, parseBeliefBase, parseBeliefBaseFromFile, parseFormula, parseFormulaFromFile, parseListOfBeliefBases, parseListOfBeliefBases, parseListOfBeliefBasesFromFile, parseListOfBeliefBasesFromFile
-
Constructor Details
-
QCirParser
public QCirParser()Default
-
-
Method Details
-
getOutputVariable
Return the output gate of this QCir problem.- Returns:
- the output gate of this QCir problem.
-
parseBeliefBase
Description copied from class:Parser
Parses the given reader into a belief base of the given type.- Specified by:
parseBeliefBase
in classParser<PlBeliefSet,
PlFormula> - Parameters:
reader
- a reader- Returns:
- a belief base
- Throws:
IOException
- if some IO issue occurred.ParserException
- some parsing exceptions may be added here.
-
parseFormula
Description copied from class:Parser
Parses the given reader into a formula of the given type.- Specified by:
parseFormula
in classParser<PlBeliefSet,
PlFormula> - Parameters:
reader
- a reader- Returns:
- a formula
- Throws:
IOException
- if some IO issue occurred.ParserException
- some parsing exceptions may be added here.
-