[antlr-interest] Re: recognizer vs translator

Adrian Sandor aditsu at yahoo.com
Tue Jul 8 01:07:17 PDT 2003


thanks for the advice;
I followed this path, however the tree grammar ends up being almost 
as complicated as the parser grammar, and I still need to modify both 
in parallel, is there any way I can improve this? maybe by using 
wildcards or reusing parser rules?

what I'm trying to do is a source code formatter for C++

Adrian

--- In antlr-interest at yahoogroups.com, Matt Benson <gudnabrsam at y...> 
wrote:
> I think the accepted way to do this is to have your
> grammar create an AST, then create a TreeParser that
> walks your AST and performs your translation for you.
> 
> -Matt
> 
> --- Adrian Sandor <aditsu at y...> wrote:
> > 
> > If I have a grammar which is good for recognizing a
> > language, then 
> > how can I write a translator for that language
> > without modifying the 
> > grammar? I mean I want to keep the translator rules
> > separately (even 
> > if they are in the same file).
> > 
> > Adrian



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list