[antlr-interest] Complex AST transformaton

Loring Craymer lgcraymer at yahoo.com
Sat Dec 13 19:16:35 PST 2008


What Ter meant was to import the AST2 token types into the lexer (and, indirectly, into the parser).  Basically, reserve the AST2 types before the parser token types are determined.

--Loring



----- Original Message ----
> From: Oliver Zeigermann <oliver.zeigermann at gmail.com>
> To: Terence Parr <parrt at cs.usfca.edu>
> Cc: antlr-interest Interest <antlr-interest at antlr.org>
> Sent: Saturday, December 13, 2008 3:07:05 AM
> Subject: Re: [antlr-interest] Complex AST transformaton
> 
> Oh, I did not know about grammar import. Nice.
> 
> Thanks for the help!
> 
> I have not properly described my problem, though. I have the following
> processing chain:
> 
> Input --Lexer--> Token Stream
> 
> --Parser--> AST0
> 
> --Tree Transformer--> AST1 (still having the token types of defined in
> the parser)
> 
> --Tree Translator--> AST2 (having a completely new set of token types)
> 
> --Tree Template Emitter--> Final Output
> 
> As the token types used in AST1 are defined in the parser, how could I
> use grammar import from AST2? I guess that does not work, right? There
> will be a clash of token types anyway?!
> 
> Oliver
> 
> 2008/12/12 Terence Parr :
> > Try a grammar import (from where the new tokens come from).  that hsould
> > give a union of AST1/AST2 token types.
> > Ter
> > On Dec 12, 2008, at 4:36 AM, Oliver Zeigermann wrote:
> >
> >> Folks!
> >>
> >> I am struggeling to how to make a complex AST1 -> AST2 transformation
> >> where the token types of AST1 are completely different from those in
> >> AST2. How do I specify "tokenVocab" in this case? Do I have to create
> >> a token file manually?
> >>
> >> Any hints welcome :)
> >>
> >> Oliver
> >>
> >> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> >> Unsubscribe:
> >> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> >>
> >
> >
> 
> 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