[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:50:07 PDT 2009


I sounded rude! You are all legends, I just didn't want to delve into the
C/Java bytecode yet, just in order to learn the basic syntax. It's the basic
syntax is all I need right now, hence my request for an example translator
of "hi" -> "hello", and I can't find it "bunched together" as such.

Many thanks,
N

2009/10/26 Naveen Chawla <naveen.chwl at googlemail.com>

> Sorry if I sound rushed, I'm doing so many other things as well.
>
> Regards, N
>
> 2009/10/26 Naveen Chawla <naveen.chwl at googlemail.com>
>
> 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/faeff816/attachment.html 


More information about the antlr-interest mailing list