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

lgcraymer lgc at mail1.jpl.nasa.gov
Tue Jun 18 00:17:02 PDT 2002


--- In antlr-interest at y..., Ric Klaren <klaren at c...> wrote:
> On Fri, Jun 14, 2002 at 09:03:18PM -0000, lgcraymer wrote:
> > I've fixed the AST bugs in the Java version--the original 
> > implementation specifies variables as being of class CommonAST or 
> > <specialAST> or whatever; if your declare them as "AST" (generic) 
and 
> > fix the typecasting, you can avoid the type coercion problems (you
> > don't have to read the code; the compiler complains and the
> > corrections are pretty obvious).
> 
> Sounds great =)
> 
> > I haven't looked at the C++ implementation, but I assume that 
you've got
> > something equivalent to the AST interface (the code generator 
needs only
> > generic AST functionality except for AST creation).  There are 
also a
> > couple of bugs in the tree generation which I had to fix.  
> 
> Well C++ output is complicated by the reference counting class. I've 
toyed
> around with it several times when I started to work on antlr. Yet II
> couldn't solve things in a nice way at that time. Basically I'd like 
to
> scrap most of the current runtime as soon as 2.7.2 is released.

I've got an idea for restructuring the AST generation code--basically, 
build a vector of tree construction commands and then interpret the 
commands for code generation--that would do away with much of the 
gratuitous gc in the current implementation.  Unfortunately, that 
requires disallowing manual AST construction in actions (at least when 
mixed with automatic construction) which is not an option for 
2.x--mixed construction is pretty much standard practice for 2.x.

If Ter gets the output grammar stuff worked out, it should be easy to 
rewrite the ANTLR code generating backend (XXXCodeGenerator.XXX) for 
3.0; he's also talking about splitting out the library support code in 
a cleaner manner.  It probably makes more sense to figure out a 
redesign for the ANTLR backend for 3.0 rather than further rebuilds of 
2.x.  Got any good ideas?  It would be good if 3.0 did not require 3-4 
KLOC for a retargeting.  (I'd like to have OCaml as a target.)

> 
> > My version of ANTLR uses heterogeneous ASTs to generate tree 
grammars, so I
> > had to make that work.  I'll be able to make my extensions (and 
bug fixes)
> > available Real Soon Now--mostly the delay is that I haven't had 
time to
> > take the last few steps in the release process.
> 
> I'm looking forward to your work :)

I'm looking forward to having it released--it feels awkward to discuss 
work that I haven't yet made generally available.

--Loring

> 
> Ric
> -- 
> 
-----+++++*****************************************************+++++++
++-------
>     ---- Ric Klaren ----- klaren at c... ----- +31 53 4893722  ----
> 
-----+++++*****************************************************+++++++
++-------
> Wit is cultured insolence. --- Aristotle


 

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



More information about the antlr-interest mailing list