I am trying to generate an AST with Java, for that I used this code:
String src = "int k = 5;";
cAST3Lexer lexer = new cAST3Lexer(new ANTLRStringStream(src));
System.out.println("a");
cAST3Parser parser = new cAST3Parser(new CommonTokenStream(lexer));
System.out.println("b");
CommonTree arbre = (CommonTree)parser.translation_unit().getTree();
DOTTreeGenerator gen = new DOTTreeGenerator();
StringTemplate st = gen.toDOT(arbre);
System.out.println(st);
Unfortunatly, when I run the programme the code stops at this line :
cAST3Parser parser = new cAST3Parser(new CommonTokenStream(lexer));
Well the programme is still running, but the "b" won't be printed.It seems I can then write on the console. Did I do something wrong ? Here is my grammar .
http://sd-g1.archive-host.com/membres/up/24fe084677d7655eb57ba66e1864081450017dd9/cAST3.txt