[antlr-interest] Re: Modification of Node Attributes using Tree Grammar

Ric Klaren klaren at cs.utwente.nl
Fri Jun 14 01:37:44 PDT 2002


Hi,

On Thu, Jun 13, 2002 at 10:18:30PM -0000, lgcraymer wrote:
> which translate to calling the ASTFactory with default object type.  
> Heterogeneous ASTs are quite useful:  it's the implementation which is 
> suboptimal.  A good implementation approach would be to have a table 
> associating types with classes assigned to the ASTFactory by the
> grammar processor

This is what C++ codegen does in 2.7.2aX . Still waiting on Terence's go
for porting this to java codegen.

> --right now, the grammar processor passes class 
> information to the AST factory for every AST creation, and creations 
> in actions bypass the grammar processor's knowledge. 

Indeed the astfactory is not the only pitfall in the current heterogeneous
ast implementation. If you decide to use heterogeneous AST's be sure to
read the generated code for correctness. 

Oh boy this stuff is *so* broken. C++ mode may currently do marginally
better than java. But AFAIK hardly anyone is using this stuff, else we
would see much more questions about it.

I'm repeating myself (probably :) ) that we either should implement this
right (C++ and Java), or remove it altogether. Or put a big sign on it with
big friendly fuzzy letters with *beware*. Interaction between action
parsers (the stuff generating the #i #( .. )) and the real parser is due
for an overhaul)

In short... Use heterogeneous AST's if you feel lucky/adventourous.

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
  "I don't have anything against Java - it's the best damn implementation
              of UCSD Pascal ever released..." --- Larry Smith


 

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



More information about the antlr-interest mailing list