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

Ric Klaren klaren at cs.utwente.nl
Sat Nov 22 07:09:43 PST 2003


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.

Cheers,

Ric
-- 
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
  Quidquid latine dictum sit, altum viditur.
                 (Whatever is said in Latin sounds profound.)


 

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




More information about the antlr-interest mailing list