[antlr-interest] AST writer

Monty Zukowski monty at codetransform.com
Wed Jul 14 15:31:46 PDT 2004


Well, if you don't do "!" or "^" then you don't have a tree, you have a 
list.  Or actually a TokenStream.

See Ter's article http://www.antlr.org/article/rewrite.engine/index.tml

Monty

On Jul 14, 2004, at 2:44 PM, thrutchy wrote:

> Is there a way to write out an AST in the same format as it was parsed
> into the AST without having to write a tree-parser rule for each rule
> of the parser?  To do this, I would assume you couldn't put in any
> "!"/"^" in the rules and the text can't be munged or ignored (i.e.
> whitespace/comments).
>
> I would like to write a language munger that does this:
>
> 1. Read language input into an AST
>
> 2. Do manipulations to the AST (via a tree-walker or manually)
>
> 3. Write the AST out in the same input language
>
> I would prefer not to have to specify the language twice - once in the
> parser and once in the writer.
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>

ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit -- 
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list