[antlr-interest] ANTLR translation - e.g. Java->tree->Java

Matt Benson gudnabrsam at yahoo.com
Mon Jun 23 07:54:06 PDT 2003


I once saw an educational project that was at least
influenced by Ter and some other folks, that built
symbol tables and all.  Also, the Transmogrify project
on sourceforge used ANTLR for refactoring.  I spent
several months bastardizing its code to my liking for
a code-completion tool but have never finished the
project.  I took a huge break from what I was working
on because I just didn't understand what was going on
with ANTLR.  So I followed Ter's USF course as much as
possible, and I've just finished a 2000+ line parser
grammar file that actually works so I think I must
have gained some useful knowledge.  Next I have to
master lexer and treeparser grammars.

If all you want to do is reconstitute a Java file from
the AST it sounds like Jalopy would be one of the
simplest options--projects that build symbol tables
are probably more complex than you would want to get
tangled up with.

-Matt

--- Tim Tyler <tt2333 at yahoo.co.uk> wrote:
> I'm contemplating an ANTLR translation project.
> 
> To do this I need to reconstruct the Java file from
> its tree.
> 
> There seem to be several problems.
> 
> One is that unicode information seems to get
> blatted.
> 
> Another is that most of the Java parsers I can see
> strip out comments and white space.  I'm likely to
> be wanting to preserve these as much as possible -
> and maybe have them in the parse tree.
> 
> About the only existing Java ANTLR translation
> project
> I'm aware of is Jalopy:
> http://jalopy.sourceforge.net/
> 
> Jalopy suggests that something is at least possible
> - but
> it is big and complex - and I'd like a bit of a less
> hairy
> example.
> 
> Are there any other ANTLR translation projects out
> there?
> 
> I'm a bit suprised ANTLR isn't already a little more
> translation-
> oriented.
> 
> After all, being able to reconstruct the original
> file is a good 
> test for having parsed it correctly ;-)
> 
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/ 
> 
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

 

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




More information about the antlr-interest mailing list