[antlr-interest] Generating AST parser at runtime

Hunter Freyer yt at hjfreyer.com
Mon May 25 15:41:14 PDT 2009


Howdy all,

I have a perhaps unorthodox request. Normally ANTLR takes a grammar file and
outputs a (in my case) java file which, in turn, reads an input text and
produces an AST; I was wondering if there's a way to skip the writing of the
Java file and just get a Java object which translates the input text into an
AST.

Essentially, I'm looking for a function which takes a Grammar in some form
(perhaps an org.antlr.tool.Grammar) and an input text, and returns an AST
all within one java session.  I'd really prefer not to go through the hoops
of outputting a java file and loading it with reflection. It seems like it
should be a lot easier than that.

Is this supported? If not, any tips on how I might be able to go about this?

kthxbai,
Hunter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090525/d4bc3ff7/attachment.html 


More information about the antlr-interest mailing list