예제 #1
0
 @Override
 public void visit(InjectedKLabel node) {
   if (node.isGround() && node.isNormal()) {
     rhsSchedule.add(RHSInstruction.PUSH(node));
   } else {
     node.injectedKLabel().accept(this);
     rhsSchedule.add(RHSInstruction.CONSTRUCT(new Constructor(ConstructorType.INJECTED_KLABEL)));
   }
 }
예제 #2
0
 @Override
 public void visit(KLabelInjection node) {
   if (node.isGround() && node.isNormal()) {
     rhsSchedule.add(RHSInstruction.PUSH(node));
   } else {
     node.term().accept(this);
     rhsSchedule.add(RHSInstruction.CONSTRUCT(new Constructor(ConstructorType.KLABEL_INJECTION)));
   }
 }
예제 #3
0
 @Override
 public void visit(KItemProjection node) {
   if (node.isGround() && node.isNormal()) {
     rhsSchedule.add(RHSInstruction.PUSH(node));
   } else {
     node.term().accept(this);
     rhsSchedule.add(
         RHSInstruction.CONSTRUCT(new Constructor(ConstructorType.KITEM_PROJECTION, node.kind())));
     rhsSchedule.add(RHSInstruction.PROJECT);
   }
 }
예제 #4
0
 @Override
 public void visit(KItem node) {
   if (node.isGround() && node.isNormal()) {
     rhsSchedule.add(RHSInstruction.PUSH(node));
   } else {
     node.kList().accept(this);
     node.kLabel().accept(this);
     rhsSchedule.add(
         RHSInstruction.CONSTRUCT(
             new Constructor(ConstructorType.KITEM, node.getSource(), node.getLocation())));
     rhsSchedule.add(RHSInstruction.EVAL);
   }
 }
예제 #5
0
 @Override
 public void visit(BuiltinList node) {
   if (node.isGround() && node.isNormal()) {
     rhsSchedule.add(RHSInstruction.PUSH(node));
   } else {
     for (int i = node.size() - 1; i >= 0; i--) {
       node.get(i).accept(this);
     }
     rhsSchedule.add(
         RHSInstruction.CONSTRUCT(
             new Constructor(
                 ConstructorType.BUILTIN_LIST,
                 node.size(),
                 node.sort,
                 node.operatorKLabel,
                 node.unitKLabel)));
   }
 }
예제 #6
0
 @Override
 public void visit(KList node) {
   if (node.isGround() && node.isNormal()) {
     rhsSchedule.add(RHSInstruction.PUSH(node));
   } else {
     int size = 0;
     if (node.hasFrame()) {
       node.frame().accept(this);
       size++;
     }
     for (int i = node.concreteSize() - 1; i >= 0; i--) {
       Term k = node.get(i);
       k.accept(this);
       size++;
     }
     rhsSchedule.add(RHSInstruction.CONSTRUCT(new Constructor(ConstructorType.KLIST, size)));
   }
 }
예제 #7
0
 @Override
 public void visit(BuiltinSet node) {
   if (node.isGround() && node.isNormal()) {
     rhsSchedule.add(RHSInstruction.PUSH(node));
   } else {
     int sizeBase = 0;
     for (Term base : node.baseTerms()) {
       base.accept(this);
       sizeBase++;
     }
     int sizeElem = 0;
     for (Term elem : node.elements()) {
       elem.accept(this);
       sizeElem++;
     }
     rhsSchedule.add(
         RHSInstruction.CONSTRUCT(
             new Constructor(ConstructorType.BUILTIN_SET, sizeElem, sizeBase)));
   }
 }
예제 #8
0
 @Override
 public void visit(BuiltinMap node) {
   if (node.isGround() && node.isNormal()) {
     rhsSchedule.add(RHSInstruction.PUSH(node));
   } else {
     int sizeBase = 0;
     for (Term base : node.baseTerms()) {
       base.accept(this);
       sizeBase++;
     }
     int sizeElem = 0;
     for (Map.Entry<Term, Term> entry : node.getEntries().entrySet()) {
       entry.getValue().accept(this);
       entry.getKey().accept(this);
       sizeElem++;
     }
     rhsSchedule.add(
         RHSInstruction.CONSTRUCT(
             new Constructor(ConstructorType.BUILTIN_MAP, sizeElem, sizeBase)));
   }
 }