How can I access the ANTLR parse tree?

293 Views Asked by At

I am using ANTLR v. 4.5.2, ANTLRWorks 2.1 and the made available grammar for tSQL right now.

ANTLRWorks generates me a perfect parse tree from my SQL code but I want to use ANTLR in my webapplication (without ANTLRWorks).

I already generated my tsql.tokens, BaseListener, lexer, and so on but how can I call ANTLR from an already existing Java class?

I don't need the parse tree as graphic I need just Java objects for the parse tree nodes (for example SET_STATEMENTS)

1

There are 1 best solutions below

2
On BEST ANSWER

Once generated from .g4 files, those Java source files can be include in your Java project and compiled together with your other files.

You don't need those .g4 files to be compiled at runtime.