[antlr-interest] Why cant += be used without an "output=" option (and other Q's)
Benjamin Shropshire
shro8822 at vandals.uidaho.edu
Sun Feb 17 15:15:16 PST 2008
Thomas Brandon wrote:
> On Feb 17, 2008 6:25 AM, Benjamin Shropshire
> <shro8822 at vandals.uidaho.edu> wrote:
>
>>
> Given ANTLRs very good inbuilt AST support I can't see many reasons to
> not use this if you are building an AST. You can produce any sort of
> output tree you want. And can still use custom AST building code with
> output=AST. Though ANTLRs tree construction operators and rewrite
> rules mean this is rarely difficult.
>
One cases (abet not common) would be where the programmer is trying to
generate faster (or less memory intensive) code. By taking total control
of the AST I can build the final AST that /I/ want in the first pass
rather than in another pass with a tree parser. this would allow total
control over the node types and also allow the use of much less generic
constructs. I also suspect that the added complexity of the 2 pass
system (at first) is more than the removed complexity of not having to
generate the AST stuff my self, especially because I will more than
likely do just that in the tree parser.
>> the part I'm dissatisfied with is the front page. As I see it there are
>> a few critical pieces of information that need to be added (or be
>> obversely linked from it) these include a 2-3 sentence description of
>> what antler expects the user to do ("Antlr is a system for building
>> recognizers, token parsers and tree parsers. It is designed to be used
>> to build token parsers from language agnostic grammars that are then
>> used to feed language specific tree parsers to perform the custom data
>> operations. <verbiage about StringTemplate> While it can operate in
>> other modes these are what it is intended to do.")
>>
> Well, it's likely any such description\page would still have given the
> impression that ANTLR was suitable for what you wanted.
From what you said, ANTLR is suitable for what I want, in theory just
not in practices. But saying that the major use profile is something
else would have bean a huge hit as to my problems. I tend to be a
minimalist when learning things. I learn the absolute minimum I can to
get started and then learn stuff as I need it to do what I need. If
something about ANTLR being designed to generate AST building code had
bean on the front page (or there abouts) I would have gone and looked
for that info rather than skip it because I didn't see how I needed it.
> It is designed
> to be it was just the implementation was lagging behind, and the lack
> of usage meant this hadn't been as major a concern as such problems in
> other areas might have been.
> But certainly such a comparison page in the wiki sounds like a good idea.
>
> Tom.
>
>> Sorry about the rambling post:
>> Benjamin Shropshire
>>
More information about the antlr-interest
mailing list