[antlr-interest] Can somebody give me the very simplest example of grammar to AST to StringTemplate output

Naveen Chawla naveen.chwl at googlemail.com
Mon Oct 26 11:33:49 PDT 2009


I can't open the "tpantlr-code" file in that archive, for some reason. Can
somebody give me, for example "a: 'hello'; ", just that single symbol
grammar, then making an AST from it, then a Tree grammar, and using
StringTemplate to output "hi" from it. I can't find such a simple example
anywhere. i.e. "hi" -> "hello". Surely someone who has used the
features many times would take just a few seconds even from memory.

2009/10/24 Indhu Bharathi <indhu.b at s7software.com>

>  Section 9.6 of ANTLR definitive reference (Building a Java Bytecode
> Generator Using a Tree Grammar and Templates) does this.
>
>
>
> The free code samples are available at
> http://media.pragprog.com/titles/tpantlr/code/tpantlr-code.tgz
>
>
>
> Samples for this specific section is available at
> ‘Code/templates/generator’ inside the archive.
>
>
>
> The book has a very good explanation too.
>
>
>
> Cheers, Indhu
>
>
>
>
>
> *From:* antlr-interest-bounces at antlr.org [mailto:
> antlr-interest-bounces at antlr.org] *On Behalf Of *Naveen Chawla
> *Sent:* Saturday, October 24, 2009 9:11 AM
> *To:* Terence Parr
> *Cc:* ANTLR Interest Mailing List
> *Subject:* Re: [antlr-interest] Can somebody give me the very simplest
> example of grammar to AST to StringTemplate output
>
>
>
> No, where?
> Many thanks, N
>
> 2009/10/23 Terence Parr <parrt at cs.usfca.edu>
>
> have you looked at the (free) code for both books?
> Ter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091026/b5f04ffe/attachment.html 


More information about the antlr-interest mailing list