<commit_before>package interpres;

import java.io.*;
import org.antlr.runtime.*;
import org.antlr.runtime.tree.*;
import interpres.ast.Node;

public class App {
  public static void main(String[] args) throws IOException, RecognitionException {
    // Create a token stream
    GrammarLexer lexer = new GrammarLexer(new ANTLRInputStream(System.in));
    CommonTokenStream tokens = new CommonTokenStream(lexer);

    // Parse the input using the token stream
    GrammarParser parser = new GrammarParser(tokens);
    CommonTree tree = (CommonTree)parser.parse().getTree();

    // Transform the ANTLR tree into a Java AST
    CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree);
    TreeWalker walker = new TreeWalker(nodes);
    TreeWalker.walk_return walkReturn = walker.walk();
    
    // Evaluate the AST
    System.out.println(walkReturn.node.evaluate());
  }
}
<commit_msg>Output syntax tree and evaluate ast<commit_after>package interpres;

import java.io.*;
import org.antlr.runtime.*;
import org.antlr.runtime.tree.*;

public class App {
  public static void main(String[] args) throws IOException, RecognitionException {
    // Create a token stream
    GrammarLexer lexer = new GrammarLexer(new ANTLRInputStream(System.in));
    CommonTokenStream tokens = new CommonTokenStream(lexer);

    // Parse the input using the token stream
    GrammarParser parser = new GrammarParser(tokens);
    CommonTree tree = (CommonTree)parser.parse().getTree();

    System.out.println("Syntax tree:");
    System.out.println(tree.toStringTree());

    // Transform the ANTLR tree into a Java AST
    CommonTreeNodeStream nodeStream = new CommonTreeNodeStream(tree);
    TreeWalker walker = new TreeWalker(nodeStream);
    TreeWalker.walk_return walkReturn = walker.walk();

    // Evaluate the AST
    System.out.println("Evaluated result:");
    System.out.println(walkReturn.ast.evaluate());
  }
}

{'fraction_non_alphanumeric': 0.10236220472440945, 'fraction_numerical': 0.0, 'mean_word_length': 4.109919571045577, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '500711', 'n_tokens_mistral': 559, 'n_tokens_neox': 534, 'n_words': 150}