Examples of Decl


Examples of kodkod.ast.Decl

    if (skolemDepth>=0 && (negated && quant==ALL || !negated && quant==SOME)) { // skolemizable formula
      final List<Formula> rangeConstraints = new LinkedList<Formula>();
      final List<Formula> domConstraints = new LinkedList<Formula>();
     
      for(Decl decl : decls) { 
        final Decl skolemDecl = visit(decl);
       
        final Relation skolem = Relation.nary("$"+ skolemDecl.variable().name(), nonSkolems.size() + skolemDecl.variable().arity());
        reporter.skolemizing(decl, skolem, nonSkolemsView);
       
        final Expression skolemExpr = skolemExpr(skolemDecl, skolem);
       
        final Multiplicity mult = decl.multiplicity();
        rangeConstraints.add(source(skolemExpr.in(skolemDecl.expression()), decl));
        if (mult!=Multiplicity.SET) {
          rangeConstraints.add(source(skolemExpr.apply(mult), decl));
        }

        if (!nonSkolems.isEmpty())
View Full Code Here

Examples of kodkod.ast.Decl

    if (currentDecl==decls.size()) {
      matrix.set(partialIndex, factory.and(declConstraints, formula.accept(this)));
      return;
    }

    final Decl decl = decls.get(currentDecl);
    final BooleanMatrix declTransl = visit(decl);
    final int position = (int)StrictMath.pow(interpreter.universe().size(), decls.size()-currentDecl-1);
    final BooleanMatrix groundValue = factory.matrix(declTransl.dimensions());
    env = env.extend(decl.variable(), groundValue);
    for(IndexedEntry<BooleanValue> entry : declTransl) {
      groundValue.set(entry.index(), BooleanConstant.TRUE);
      comprehension(decls, formula, currentDecl+1, factory.and(entry.value(), declConstraints),
          partialIndex + entry.index()*position, matrix);
      groundValue.set(entry.index(), BooleanConstant.FALSE)
View Full Code Here

Examples of kodkod.ast.Decl

    if (decls.size()==currentDecl) {
      acc.add(factory.or(declConstraints, formula.accept(this)));
      return;
    }

    final Decl decl = decls.get(currentDecl);
    final BooleanMatrix declTransl = visit(decl);
    final BooleanMatrix groundValue = factory.matrix(declTransl.dimensions());
    env = env.extend(decl.variable(), groundValue);
    for(IndexedEntry<BooleanValue> entry : declTransl) {
      groundValue.set(entry.index(), BooleanConstant.TRUE);
      all(decls, formula, currentDecl+1, factory.or(factory.not(entry.value()), declConstraints), acc);
      groundValue.set(entry.index(), BooleanConstant.FALSE)
    }
View Full Code Here

Examples of kodkod.ast.Decl

    if (decls.size()==currentDecl) {
      acc.add(factory.and(declConstraints, formula.accept(this)));
      return;
    }

    final Decl decl = decls.get(currentDecl);
    final BooleanMatrix declTransl = visit(decl);
    final BooleanMatrix groundValue = factory.matrix(declTransl.dimensions());
    env = env.extend(decl.variable(), groundValue);
    for(IndexedEntry<BooleanValue> entry : declTransl) {
      groundValue.set(entry.index(), BooleanConstant.TRUE);
      some(decls, formula, currentDecl+1, factory.and(entry.value(), declConstraints), acc);
      groundValue.set(entry.index(), BooleanConstant.FALSE)
    }
View Full Code Here

Examples of kodkod.ast.Decl

    if (decls.size()==currentDecl) {
      values.add( expr.accept(this).choice(declConstraints, factory.integer(0)) );
      return;
    }

    final Decl decl = decls.get(currentDecl);
    final BooleanMatrix declTransl = visit(decl);
    final BooleanMatrix groundValue = factory.matrix(declTransl.dimensions());
    env = env.extend(decl.variable(), groundValue);
    for(IndexedEntry<BooleanValue> entry : declTransl) {
      groundValue.set(entry.index(), BooleanConstant.TRUE);
      sum(decls, expr, currentDecl+1, factory.and(entry.value(), declConstraints), values);
      groundValue.set(entry.index(), BooleanConstant.FALSE)
    }
View Full Code Here

Examples of kodkod.ast.Decl

   * @return { d: Declaration |  d.variable = declaration.variable.accept(this) &&
   *                             d.multiplicity = decl.multiplicity &&
   *                             d.expression = declaration.expression.accept(this)
   */
  public Decl visit(Decl decl) {
    Decl ret = lookup(decl);
    if (ret!=null) return ret;
   
    final Variable variable = (Variable) decl.variable().accept(this);
    final Expression expression = decl.expression().accept(this);
    ret = (variable==decl.variable() && expression==decl.expression()) ?
View Full Code Here

Examples of org.antlr.v4.codegen.model.decl.Decl

        defineImplicitLabel(ID, matchOp); // adds _X
        TokenListDecl l = getTokenListLabelDecl(label);
        rf.addContextDecl(ID.getAltLabel(), l);
      }
      else {
        Decl d = getTokenLabelDecl(label);
        matchOp.labels.add(d);
        rf.addContextDecl(ID.getAltLabel(), d);
      }

//      Decl d = getTokenLabelDecl(label);
View Full Code Here

Examples of org.antlr.v4.codegen.model.decl.Decl

        defineImplicitLabel(setAST, matchOp);
        TokenListDecl l = getTokenListLabelDecl(label);
        rf.addContextDecl(setAST.getAltLabel(), l);
      }
      else {
        Decl d = getTokenLabelDecl(label);
        matchOp.labels.add(d);
        rf.addContextDecl(setAST.getAltLabel(), d);
      }
    }
    if ( controller.needsImplicitLabel(setAST, matchOp) ) defineImplicitLabel(setAST, matchOp);
View Full Code Here

Examples of org.antlr.v4.codegen.model.decl.Decl

  public List<SrcOp> wildcard(GrammarAST ast, GrammarAST labelAST) {
    Wildcard wild = new Wildcard(this, ast);
    // TODO: dup with tokenRef
    if ( labelAST!=null ) {
      String label = labelAST.getText();
      Decl d = getTokenLabelDecl(label);
      wild.labels.add(d);
      getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), d);
      if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) {
        TokenListDecl l = getTokenListLabelDecl(label);
        getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), l);
View Full Code Here

Examples of org.antlr.v4.codegen.model.decl.Decl

      c = getComplexChoiceBlock(blkAST, alts);
    }

    if ( labelAST!=null ) { // for x=(...), define x or x_list
      String label = labelAST.getText();
      Decl d = getTokenLabelDecl(label);
      c.label = d;
      getCurrentRuleFunction().addContextDecl(labelAST.getAltLabel(), d);
      if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN  ) {
        String listLabel = gen.getTarget().getListLabel(label);
        TokenListDecl l = new TokenListDecl(this, listLabel);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.