[antlr-interest] How to extend Java language using ANTLR

Tony O'Hagan tohagan at itee.uq.edu.au
Sun Jan 16 21:35:33 PST 2005


I'm considering writing a source to source translator that will extend 
the Java language to include some additional expressions, statements 
and possibly some modified type constructs - all of which will map to 
Java source code.

Q. What approach would you recommend to minimize the code generation effort?

I understand that I'll probably parse the input using a modified version of 
one of the sample Java grammars.  Since this will be a source to source
translator with Java as input and output language, I'd like to try to avoid 
or minimize the coding for all the of one to one mappings that will occur
for most
grammar rules.

I suspect I'll still need to build up a symbol table of declared types and
variables
but for the purposes of a research prototype I may end up using simpler type
declarations 
that will still easily map to existing Java type declarations.  

This sounds like it would a "been there done that".  Perhaps someone can
point me at 
an complete example of how they did a language extension of this type.
A Java, C# or C++ example would be nice.

Thanks,
Tony O'Hagan

------------------------------------
ITEE, University of Queensland
Tony O'Hagan
Senior Research Officer
School of Information Technology & Electrical Engineering
University of Qld., Brisbane, Australia
------------------------------------



More information about the antlr-interest mailing list