[antlr-interest] how to get parse trees WAS A postmortem of my use of antler

Terence Parr parrt at cs.usfca.edu
Tue Mar 11 15:10:08 PDT 2008


Perhaps FAQ entry "How can I build parse trees not ASTs?" will help?

http://www.antlr.org/wiki/pages/viewpage.action?pageId=1760

Ter

On Mar 11, 2008, at 2:33 PM, Andy Tripp wrote:

> Terence Parr wrote:
>>
>> On Mar 11, 2008, at 11:35 AM, Andy Tripp wrote:
>>
>>> Terence Parr wrote:
>>>> how could ANTLR *possibly* know the structure of the AST to build  
>>>> except for, perhaps, expressions? parse tree, yes. AST, no.
>>> How about have the AST just match the parse tree by default?
>>
>> Because then you add one ^ or -> rewrite and what should it do?   
>> Give you a hybrid?
> Give an error.
>> That just wouldn't be useful.
> No, a hybrid wouldn't be very useful.
>> If you want a parse tree use it.
> Ummm...sorry for the newbie question. How do I get ANTLR to produce  
> a parse tree?
> I looked through all instances of "parse tree" in the book and  
> couldn't find the answer. I
> see that ANTLRWorks shows it, and obviously the code itself is a  
> parse tree. But is there
> some option that says "give me the parse tree as a data structure?"
>>
>>
>> Ter
>>
>



More information about the antlr-interest mailing list