[antlr-interest] AST Translation

Thomas Brandon tbrandonau at gmail.com
Mon Aug 25 10:56:52 PDT 2008

No. The token types will clash so you couldn't import both. You need a
common tokenVocab for the two tree parsers to import.
You maybe able to use the grammar import feature to get ANTLR to do
this for you. If you process a grammar that imports both tree parsers
then the output tokens file produced for this grammar should be what
you want to import into the seperate tree grammars. Should be fairly
easy to integrate this into a build process, just process the
importing grammar before the seperate grammars and delete all it's
output apart from the tokens file.
Otherwise you could create a script\program to do it.

On Tue, Aug 26, 2008 at 3:34 AM, Bill Andersen
<andersen at ontologyworks.com> wrote:
> Folks
> I have two surface languages A and B, with two associated abstract
> syntaxes (expressed in separate tree grammars).  I'd like to write a
> tree parser that translates ASTs for language A into ASTs for language
> B.  Is there an easy way to supply two sets of tokens for the
> tokenVocab option for the translation grammar?
>        .bill
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address

More information about the antlr-interest mailing list