Search in sources :

Example 21 with Node

use of de.be4.classicalb.core.parser.node.Node in project probparsers by bendisposto.

the class PrologGeneratorHelper method det.

public void det(ADetLtl node, PrologGenerator gen) {
    LinkedList<PActions> list = node.getArgs();
    pto.openTerm("ap");
    pto.openTerm("det");
    pto.openList();
    for (PActions pLtl : list) {
        pLtl.apply(gen);
    }
    pto.closeList();
    pto.closeTerm();
    pto.closeTerm();
}
Also used : PActions(de.be4.ltl.core.parser.node.PActions)

Example 22 with Node

use of de.be4.classicalb.core.parser.node.Node in project probparsers by bendisposto.

the class LTLFormulaVisitor method handleQuantification.

private void handleQuantification(de.be4.ltl.core.parser.node.Node node, String parameterName, String bPredicateString, PLtl ltl) {
    // create an identifier (b ast node) for the parameter of the
    // quantification
    List<TIdentifierLiteral> list = new ArrayList<TIdentifierLiteral>();
    list.add(new TIdentifierLiteral(parameterName));
    AIdentifierExpression parameterNode = new AIdentifierExpression(list);
    // add the created identifier to the current context
    Hashtable<String, AIdentifierExpression> currentContext = new Hashtable<String, AIdentifierExpression>();
    currentContext.put(parameterName, parameterNode);
    this.contextTable.add(currentContext);
    // collection the all parameters in
    ltlIdentifierTable.put(parameterName, parameterNode);
    // parse the b predicate and create a reference to the b ast node
    de.be4.classicalb.core.parser.node.Start start = parseBPredicate(bPredicateString);
    ltlNodeToBNodeTable.put(node, start);
    // collect all identifiers which can be used in the bPredicate and
    // verify the bPredicate
    LTLBPredicate ltlBPredicate = new LTLBPredicate(getUnifiedContext(), start);
    this.bPredicates.add(ltlBPredicate);
    machineContext.checkLTLBPredicate(ltlBPredicate);
    // remaining LTL formula
    ltl.apply(this);
    // remove currentContext from contextTable
    contextTable.remove(contextTable.size() - 1);
}
Also used : AIdentifierExpression(de.be4.classicalb.core.parser.node.AIdentifierExpression) Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList) TIdentifierLiteral(de.be4.classicalb.core.parser.node.TIdentifierLiteral)

Example 23 with Node

use of de.be4.classicalb.core.parser.node.Node in project probparsers by bendisposto.

the class BoolType method createASTNode.

public PExpression createASTNode(Typechecker typechecker) {
    ABoolSetExpression node = new ABoolSetExpression();
    typechecker.setType(node, new SetType(this));
    return node;
}
Also used : ABoolSetExpression(de.be4.classicalb.core.parser.node.ABoolSetExpression)

Example 24 with Node

use of de.be4.classicalb.core.parser.node.Node in project probparsers by bendisposto.

the class FunctionType method createASTNode.

@Override
public PExpression createASTNode(Typechecker typechecker) {
    APartialFunctionExpression node = new APartialFunctionExpression(domain.createASTNode(typechecker), range.createASTNode(typechecker));
    typechecker.setType(node, new SetType(this));
    return node;
}
Also used : APartialFunctionExpression(de.be4.classicalb.core.parser.node.APartialFunctionExpression)

Example 25 with Node

use of de.be4.classicalb.core.parser.node.Node in project probparsers by bendisposto.

the class TranslatingVisitor method caseACoupleExpression.

@Override
public void caseACoupleExpression(ACoupleExpression node) {
    List<BObject> s = new ArrayList<BObject>();
    for (PExpression e : node.getList()) {
        e.apply(this);
        s.add(this.getResult());
    }
    this.setResult(new Tuple(s));
}
Also used : BObject(de.prob.translator.types.BObject) ArrayList(java.util.ArrayList) PExpression(de.be4.classicalb.core.parser.node.PExpression) Tuple(de.prob.translator.types.Tuple)

Aggregations

CheckException (de.be4.classicalb.core.parser.exceptions.CheckException)42 PExpression (de.be4.classicalb.core.parser.node.PExpression)30 ArrayList (java.util.ArrayList)30 Node (de.be4.classicalb.core.parser.node.Node)20 AIdentifierExpression (de.be4.classicalb.core.parser.node.AIdentifierExpression)16 TIdentifierLiteral (de.be4.classicalb.core.parser.node.TIdentifierLiteral)12 TPragmaIdOrString (de.be4.classicalb.core.parser.node.TPragmaIdOrString)11 VisitorException (de.be4.classicalb.core.parser.exceptions.VisitorException)8 HashSet (java.util.HashSet)8 Token (de.be4.ltl.core.parser.node.Token)7 Type (de.be4.classicalb.core.parser.IDefinitions.Type)6 IOException (java.io.IOException)6 ASTProlog (de.be4.classicalb.core.parser.analysis.prolog.ASTProlog)5 PositionedNode (de.hhu.stups.sablecc.patch.PositionedNode)5 LinkedList (java.util.LinkedList)5 BCompoundException (de.be4.classicalb.core.parser.exceptions.BCompoundException)4 LinkedHashMap (java.util.LinkedHashMap)4 Test (org.junit.Test)4 ClassicalPositionPrinter (de.be4.classicalb.core.parser.analysis.prolog.ClassicalPositionPrinter)3 NodeIdAssignment (de.be4.classicalb.core.parser.analysis.prolog.NodeIdAssignment)3