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

Terence Parr parrt at cs.usfca.edu
Tue Nov 18 13:56:08 PST 2003


On Tuesday, November 18, 2003, at 01:40 PM, lgcraymer wrote:

> Ter--
>
> There would not be any ambiguity between ^ as a suffix and ^( as a 
> tree notation--"^(" can be interpreted as a token by the lexer.
> However, the current semantics of ^ is "root", not tree or AST 
> node--that's #.  I can see the ^( as a construction syntax, but would
> prefer to keep # as a tree matching prefix.  In fact, I'd be willing 
> to change my tree construction syntax from "#{" to "^{" and "#(" to 
> "^("
> to emphasize the construct versus match differential.

Interesting.  Verrrrry interesting.  So to add an imaginary node you'd 
say:

a : A^ ^{IMAG} B ;

To make a tree like this

   A
   |
IMAG -- B

??  Looks a bit weird, the ^{...} constructor.  Is this what you were 
thinking?

I do like this for the matching:

expr : ^(PLUS expr expr) | INT ;

rather than

expr : #(PLUS expr expr) | INT ;

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