[antlr-interest] Newbie Needs help...

Nikolas Everett nik9000 at gmail.com
Wed May 21 06:59:11 PDT 2008


I learned a good portion of what I know about antlr and stringtemplate by
going through the source code for the Mantra compiler.  Its all here:
http://www.linguamantra.org/

The long and short of it is that embedding actions is great for checking
things but is more cumbersome when actually generating output.  Tree
grammars that output templates are the way to go there.

I tend to do:
1 grammar to lex and parse into an AST (output=AST)
1 grammar to verify the AST (tree grammar with no output, only embedded
actions calling a callback)
1 grammar to generate output (tree grammar with output=template)

This is wonderfully flexible because the grammars become modules, allowing
you to test them individually and substitute them at will.  This is kind of
a pain because you need to wrote three or more grammars and sync up the
output of the tree constructing grammar to the input of the others.

On Wed, May 21, 2008 at 9:45 AM, csanders <csanders at hoovers.com> wrote:

> I'm also new to ANTLR and would like to know how StringTemplate is a better
> solution, is there somewhere we can read about this ?
>
> Thanks,
> Charlie
>
> Kevina Choolhun wrote:
>
>> Hello,
>>
>> I am new at ANTLR but with the help of The Definitive ANTLR Reference have
>> managed to set up a parser and a parser walker..
>>
>> Now for the next stage, I have tried my hand at embedding actions.. but
>> Stringtemplate I hear is a much better solution.
>>
>> I am currently reading through stringtemplate.org <
>> http://stringtemplate.org>. I wanted to know if there are any nice
>> tutorials about it which could help me.. enhance my parser n lexer with
>> StringTemplate
>>
>> Thank you for your help.
>>
>> --
>> Kev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080521/91141cef/attachment.html 


More information about the antlr-interest mailing list