use of de.bmoth.parser.ast.nodes.ltl.LTLFormula in project bmoth by hhu-stups.
the class Parser method getLTLFormulaAst.
private LTLFormula getLTLFormulaAst(LtlStartContext context) throws ScopeException {
LTLFormulaAnalyser formulaAnalyser = new LTLFormulaAnalyser(context);
SemanticAstCreator astCreator = new SemanticAstCreator(formulaAnalyser);
return (LTLFormula) astCreator.getAstNode();
}
use of de.bmoth.parser.ast.nodes.ltl.LTLFormula in project bmoth by hhu-stups.
the class Parser method getLTLFormulaAsSemanticAst.
public static LTLFormula getLTLFormulaAsSemanticAst(String inputString) throws ParserException {
Parser parser = new Parser();
try {
LtlStartContext context;
context = parser.parseLTLFormula(inputString);
LTLFormula ltlFormulaAst = parser.getLTLFormulaAst(context);
TypeChecker.typecheckLTLFormulaNode(ltlFormulaAst);
return ltlFormulaAst;
} catch (ParseErrorException | ScopeException | TypeErrorException e) {
throw new ParserException(e);
}
}
use of de.bmoth.parser.ast.nodes.ltl.LTLFormula in project bmoth by hhu-stups.
the class LTLMachineTest method testSimpleLTLTestMachine.
@Test
public void testSimpleLTLTestMachine() {
MachineNode machine = new MachineBuilder().setName("SimpleLTLTestMachine").setDefinitions("ASSERT_LTL_1 == \"F({x=7})\"").setVariables("x").setInvariant("x : 1..10").setInitialization("x := 1").addOperation("foo = SELECT x < 5 THEN x := x + 1 END").build();
assertNotNull(machine);
List<LTLFormula> ltlFormulas = machine.getLTLFormulas();
LTLFormula ltl1 = ltlFormulas.get(0);
assertEquals("ASSERT_LTL_1", ltl1.getName());
}
use of de.bmoth.parser.ast.nodes.ltl.LTLFormula in project bmoth by hhu-stups.
the class LTLBuechiTest method testGraphConstructionGloballyFalsity.
@Test
public void testGraphConstructionGloballyFalsity() throws ParserException {
String formula = "G ({0=1})";
LTLFormula ltlFormula = Parser.getLTLFormulaAsSemanticAst(formula);
LTLNode node = LTLTransformations.transformLTLNode(ltlFormula.getLTLNode());
BuechiAutomaton buechiAutomaton = new BuechiAutomaton(node);
assertEquals(1, buechiAutomaton.getFinalNodeSet().size());
logger.log(Level.INFO, buechiAutomaton::toString);
}
use of de.bmoth.parser.ast.nodes.ltl.LTLFormula in project bmoth by hhu-stups.
the class LTLBuechiTest method testGraphConstructionFp1UGp2.
@Test
public void testGraphConstructionFp1UGp2() throws ParserException {
String formula = "(F {3=4}) U (G {2=3})";
LTLFormula ltlFormula = Parser.getLTLFormulaAsSemanticAst(formula);
LTLNode node = LTLTransformations.transformLTLNode(ltlFormula.getLTLNode());
BuechiAutomaton buechiAutomaton = new BuechiAutomaton(node);
assertEquals(8, buechiAutomaton.getFinalNodeSet().size());
logger.log(Level.INFO, buechiAutomaton::toString);
}
Aggregations