ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
And then run the following java code (taken from this page on the ANTLR docs):
final Grammar g = Grammar.load(combinedGrammarFileName);
LexerInterpreter lexEngine = g.createLexerInterpreter(CharStreams.fromPath(Paths.get(fileName)));
CommonTokenStream tokens = new CommonTokenStream(lexEngine);
ParserInterpreter parser = g.createParserInterpreter(tokens);
ParseTree t = parser.parse(g.getRule(startRule).index);
System.out.println("parse tree: "+t.toStringTree(parser));
return t;
And then note that contextSuperClass option isn't parsed (or used). You can also set your options like this and check that RuleContextWithAltNum isn't used:
@JRoper18 Did you find closure on this? It seems it's not just the contextSuperClass that doens't work, but Java semantic predicates and lexer @members{} blocks containing Java code.
With a Java target, just create a grammar like this:
And then run the following java code (taken from this page on the ANTLR docs):
And then note that contextSuperClass option isn't parsed (or used). You can also set your options like this and check that RuleContextWithAltNum isn't used: