[antlr-interest] ANTLR 3.0 tree construction proposal
Loring Craymer
Loring.G.Craymer at jpl.nasa.gov
Mon Jan 31 18:24:49 PST 2005
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Terence Parr
> Sent: Monday, January 31, 2005 5:28 PM
> To: ANTLR Interest
> Subject: Re: [antlr-interest] ANTLR 3.0 tree construction proposal
>
> On Jan 31, 2005, at 3:56 PM, Martin Probst wrote:
> >> First note that ^(..) and ^[...] are the things you say you didn't
> >> like
> >> (except with # instead of ^) ;)
> >
> > Well no, I said (or meant to say) I didn't like it in curly braces.
>
> Agreed. I'm trying to get everything out of actions.
>
> > a!:
> > b:myB c:myC foo:myD { #a = #(#foo,#(#[FOO],#b,#c)); }
> >
> > Is not really intuitive. How would this translate to the new scheme?
> >
> > a:
> > ^(^(FOO[]^ myB myC) myD^)
>
> It would become:
>
> a : myB myC myD -> ^(myD ^(FOO myB myC))
> ;
>
> How does that look to you? Looks good to me. :) About as clean and
> straightforward as you can get.
>
> Loring, what would your inline solution look like? Should just need a
> ^[FOO]^ or something, right?
Almost--Martin specifies two levels of trees, so it would look like
a:
myB myC ^[FOO]^ myD^ ;
--Loring
More information about the antlr-interest
mailing list