[antlr-interest] ast or not...
prabha_pady at comcast.net
Mon Dec 29 13:19:12 PST 2008
Thx for the encouraging response. I was almost going to give up because the
tree grammar syntax is just too confusing.
Meaning, merging the rewrite rules etc is just not obvious and intuitive.
----- Original Message -----
From: "Gavin Lambert" <antlr at mirality.co.nz>
To: "Pady Srinivasan" <padysrini at hotmail.com>; <antlr-interest at antlr.org>
Sent: Monday, December 29, 2008 4:14 PM
Subject: Re: [antlr-interest] ast or not...
> At 06:59 30/12/2008, Pady Srinivasan wrote:
> >I am a beginner with antlr and dynamic languages. I am reading
> >terence's antlr book. The language I am trying to develop is a
> >simple if-elseif language and some actions based on that.
> >So given this situation, would I need to be developing an
> >ast/tree grammer etc ? For simple interpreted languages, is
> >an ast/tree grammer etc really needed ?
> You never *need* an AST and/or tree grammar, and using the former
> does not imply you need to use the latter (though you can't use
> the latter without the former). They're just options available
> for use if they are more convenient or tidier than the
> When I first started using ANTLR, I carried out all the actions in
> the parser directly, since I found that simpler to work with and I
> didn't have to worry about figuring out how ASTs and tree grammars
> worked. Now that I'm more experienced with ANTLR, I tend to
> favour using ASTs and tree grammars, mostly because it leaves the
> parser grammar looking a bit tidier, and it opens up some
> possibilities for doing tree manipulation to locate or rearrange
> some constructs (which admittedly I haven't made much use of as
> yet, but the theory sounds cool).
> But basically: just use whatever you're most comfortable with.
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
More information about the antlr-interest