@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))); } }
@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))); } }
@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); } }
@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); } }
@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))); } }
@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))); } }
@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))); } }
@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))); } }