[antlr-interest] ANTLR 3.0 tree construction proposal

John D. Mitchell johnm-antlr at non.net
Thu Feb 3 19:47:51 PST 2005


>>>>> "Terence" == Terence Parr <parrt at cs.usfca.edu> writes:
[...]

>> (B) I'm concerned by the need to repeat the arguments in the RHS such as
>> in:

>> decl : "var" (ID ':' type ';')+ -> ^("var" ^(':' ID type)+) ;

>> What happens when there's two "var"s?  Which "var" is going to be used
>> as the basis on the RHS?

> it depends on how many times it's matched on the left.  If matched once
> then only one "var" node will appear in the rewrite.

I really really don't like that vagarity.


>> Re: Imaginary Nodes

>> I find the LPAREN[] utterly distasteful and expect that it will cause
>> hard to see errors.

> Yeah, it's not so great, but it is like a ctor call with no args right?
> We'll need ID["foo"] for example to create an ID node with a text value
> of "foo".

No, that's really, really ugly and very, very easy to miss.


[...]
>> Re: Attribute integration

>> As I've noted previously, I don't like the co-mingling of the dynamic
>> attributes and the local attributes.  I think it's important that those
>> separate but related constructions appear distinct from each other.

> Can you be more specific?  We may have differing ideas of what those
> terms mean ;)

Geez, stop listening to people with wacky definitions. :-)

There are dynamically scoped attributes, lexically scoped formal parameters
to rules and the formal return values, and then local, lexically scoped
variables.

What I've been arguing about here is that the dynamically scoped
"attributes" should be distinct from the lexically scoped "variables".
Treating them indistinctly is, IMNSHO, part of the problem with the old
general purpose programming languages which supported dynamically scoped
variables.


Take care,
	John


More information about the antlr-interest mailing list