[antlr-interest] Re: Comments and questions on a recent project

lgcraymer lgc at mail1.jpl.nasa.gov
Mon Aug 26 14:21:35 PDT 2002


--- In antlr-interest at y..., "Tiller, Michael (M.M.)" <mtiller at f...> 
 
> Well, this works.  But it doesn't do what I need for two reasons.  
First, it isn't language neutral.  I had to change "null" to "NULL" 
for the C++ backend.  But, more importantly, what I need is a language 
neutral way of doing this:
> 
> { #cd1->addChild(#f); #cd1->addChild(#i); #cd1->addChild(#o); }
>

As Ter pointed out, I've done that--the syntax will be
 #{ #( cd1 f i o ) }
for this code--but I haven't jumped through the final hoops to release 
the code because I keep getting distracted by "real work".

It would be hard to make ANTLR completely language neutral--you would 
have to embed a custom language to handle semantic predicates, for 
example (although that could be handled through support for macros in 
actions, I suppose)--but it would probably be worth adding syntax for 
attribute modifications and symbol table manipulation to ANTLR.

--Loring
 
> The problem is that:
> 
> { #cd1 = #(NULL,#cd1,#f,#i,#o); }
> 
> is like:
> 
> { #cd1->addSibling(#f); #cd1->addSibling(#i); #cd1->addSibling(#o); 
}
> 
> whereas
> 
> { #cd1 = #(cd1, #f, #i, #o); }
> 
> is like:
> 
> { #cd1 = #([...]); #cd1->addChild(#f); #cd1->addChild(#i); 
#cd1->addChild(#o); }
> 
> (i.e. it starts from scratch)
> 
> It is mostly a moot point since I'm not able to make my whole system 
language neutral at this point for other reasons.
> 
> To address Ter's comment about needing actions in the parser, I 
would say I guess I don't agree.  I have made a complete parser (not 
tree parser) that contains only basic tree manipulation routines.  I 
don't see any reason why all the things I needed to do to my tree 
couldn't have been done with a language neutral shorthand.
> 
> The point of my project was to establish a parser indepedent of 
application and I was 95% successful.  That is the sad thing since I 
don't see a good reason why it couldn't have been 100% successful.  
The language I'm compiling is not a procedural language so I don't 
need a backend or even an interpreter.  The language is more like 
PROLOG (i.e. declarative) so there are lots of things you can do with 
just a tree.
> 
> --
> Mike
> 
> 
> > 
> >  
> > 
> > Your use of Yahoo! Groups is subject to 
> > http://docs.yahoo.com/info/terms/ 
> > 
> >


 

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



More information about the antlr-interest mailing list