[antlr-interest] ANTLR v3 tree construction :)

Akhilesh Mritunjai virtualaspirin at yahoo.com
Thu Jun 23 15:43:48 PDT 2005


Hi Terence

Yup, in tree parser, and I vote for default in-line.
As for creating a new tree, thats what 'buildAST=true'
is there for. Am I right ? Coupled together with a
'dupTree=true' option (patch/standard), it will parser
and either build a new tree of just the traversed
nodes or 'peel-off' the whole traversed tree, if user
doesn't want to write whole grammar for un-interesting
sub-trees. 

The reason for asking this is to remove an assumption
that trees would be small enough to fit in memory! (My
trees can have around 10M nodes... and I have to scale
to ~half a billion nodes very shortly... and no I'm
not making this up, our tool will process chip
descriptions that will routinely have 10-100M gates)

Basically, what I'm looking for is a full blown ANTLR
tree-parsing stuff that whould make writing native
code (visitors etc) as un-necessary as can be... Tree
parser should be a full blown declarative language to
process and manipulate trees in a language agnostic
way.

Next thing on wish list would be a XQuery/XPath like
declarative query language to query and manipulate
tree.

Thanks for all this stuff Terence

Oh, sure you may forward my earlier response to
antlr-interest... I pressed 'reply' :-(

- Akhilesh


--- Terence Parr <parrt at cs.usfca.edu> wrote:
> So you mean in the tree parser, right?  Yes, I've
> been thinking a lot  
> about whether to copy tree to tree when output=AST
> in a tree parser  
> or to do inline modification.  Are you voting then
> for inline rewrites
> 
> top : ^(IDENT TYPE VALUE BLAH)
>          -> {removeValue(id)}? ^(IDENT ^(FOO BAR)
> ^(VALUE INT["5"])  
> BLAH)
>          -> ^(IDENT TYPE ^(FOO BAR) ^(VALUE
> INT["5"]) BLAH)
>      ;
> 
> Would this give you want you want?  I guess I still
> have the question  
> in my mind of whether the above creates a *new* tree
> or tries to  
> rewrite the existing.  Do you have a preference?
> 
> The new -> rewrite syntax is nice, right?  No
> code...portable. :)
> 
> Ter
> PS    May I send this to the antlr-interest list?
> --
> CS Professor & Grad Director, University of San
> Francisco
> Creator, ANTLR Parser Generator,
> http://www.antlr.org
> Cofounder, http://www.jguru.com
> 
> 



		
____________________________________________________ 
Yahoo! Sports 
Rekindle the Rivalries. Sign up for Fantasy Football 
http://football.fantasysports.yahoo.com


More information about the antlr-interest mailing list