[antlr-interest] #( root children ) syntax change proposal?

Terence Parr parrt at cs.usfca.edu
Sat Nov 22 12:47:40 PST 2003


On Saturday, November 22, 2003, at 07:09 AM, Ric Klaren wrote:

> Hi,
>
> On Tue, Nov 18, 2003 at 11:21:04AM -0800, Terence Parr wrote:
>> The #(...) notation derives from wanting to use parens like LISP but
>> not wanting the ambiguity with (... | ...) alternative subrules. The #
>> was the only character left in ASCII for me to use ;)  I have always
>> not liked it, but now it's ingrained.  That said, I've been thinking 
>> of
>> changing it for ANTLR 3 into
>>
>> ^(root c1 ... cn)
>>
>> in tree parsers and tree construction actions.  There MAY be some
>> ambiguity with the ^ suffix operator, but I think we might wanna try 
>> it
>> out.
>>
>> Anybody have any thoughts?  I like it as it's more intuitive that that
>> is a tree ;)  # is random.
>
> I would be inclined to make the thing target language dependant. For 
> C++
> I've very often contemplated to replace the # with something different 
> in
> order to have no trouble with preprocessor directives. ^ gives 
> conflicts
> with xor operators in the action parser parts. This would mean the 
> action
> parsers would even become bigger messes than they are now. Unless the 
> tree
> operator parts are easy to separate from the target language.

I'm thinking of having a generic imperative language for actions as the 
default so grammars with sym tab actions etc... could be portable.  I 
can handle this properly.  I'm not sure XOR is really that necessary 
directly within the action of a grammar so I'm not really worried.  # 
could be a hassle for C++ though ;)

I'd rather have a standard instead of language dependent stuff also.

Ter
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.jguru.com
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com pure link sharing




 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list