@Override
 public ASTNode visit(org.kframework.kil.Cell node, Void _void) {
   return CellCollection.singleton(
       CellLabel.of(node.getLabel()),
       (Term) this.visitNode(node.getContents()),
       null,
       globalContext.getDefinition());
 }
  @Override
  public ASTNode visit(org.kframework.kil.Definition node, Void _void) {
    Definition definition = new Definition(context, kem, indexingData);
    globalContext.setDefinition(definition);

    Module singletonModule = node.getSingletonModule();

    for (org.kframework.kil.Rule rule : singletonModule.getRules()) {
      if (rule.containsAttribute(Attribute.PREDICATE_KEY)) {
        continue;
      }

      definition.addRule((Rule) this.visitNode(rule));
    }

    for (String kLabelName : singletonModule.getModuleKLabels()) {
      definition.addKLabel(KLabelConstant.of(kLabelName, globalContext.getDefinition()));
    }

    return definition;
  }
  @Override
  public ASTNode visit(org.kframework.kil.Bag node, Void _void) {
    List<org.kframework.kil.Term> contents = new ArrayList<>();
    org.kframework.kil.Bag.flatten(contents, node.getContents());

    CellCollection.Builder builder = CellCollection.builder(null, globalContext.getDefinition());
    for (org.kframework.kil.Term term : contents) {
      if (term instanceof TermComment) {
        continue;
      }
      builder.concatenate((Term) this.visitNode(term));
    }

    return builder.build();
  }
 @Override
 public ASTNode visit(org.kframework.kil.KLabelConstant node, Void _void) {
   return KLabelConstant.of(node.getLabel(), globalContext.getDefinition());
 }
  public Definition transformDefinition(org.kframework.kil.Definition node) {
    Definition transformedDef = (Definition) this.visitNode(node);
    globalContext.setDefinition(transformedDef);

    return expandAndEvaluate(termContext, kem);
  }