GNAT and Java
Several people have discussed the idea of using the GNAT Ada
compiler to generate Java Virtual Machine (JVM) code.
If you're interested in doing this, here is a collection of related links.
You must know something about compilers or you will have a lot
of learning to do.
Also, if you're planning to start such a project, be sure to
let others know (via the newsgroup
there's no point in having several duplicative efforts.
First, read and understand the following, which have the technical
details you'll need to get started:
Then you can look at related information.
Here are some related hypertext pages you should examine:
Ada/Java page on the Ada Home.
The Lovelace page on Java and Ada.
This gives examples of Ada programs and Java.
The Team-Ada mailing list.
This list has discussed GNAT generating Java in the past, so you might want
to look at their archives. You'll probably want to join it if you're working
on an implementation.
GNAT Project Home Page. This page has the code and other useful material.
In particular, download and read all of
The source code for GNAT is freely available, and you can
get at the intermediate code used by the GNAT compiler.
web_ada mailing list. To subscribe to the mailing list,
send e-mail to "email@example.com"
with no subject line and a body consisting of the lines:
Sun's Java documentation.
He maintains GNAT and would be interested in a port to Java.
However, don't bother him until you've done your homework.
Read what's out there on the web, understand it, and then talk with him.
This all assumes you already know something
about Ada and existing web resources.
If not, have a look at
an Ada 95 tutorial,
and the Ada Home (HBAP),
an Ada-related web server.
Here are a few comments by others who have briefly looked into this:
I've chatted with various GCC- and Java VM-savvy folks about this, and
the recommendation is not to try a "normal" GCC target, because the
VM is "higher-level" than a GCC machine description. It has been
suggested that the GNAT tree would be the right place to start.
Since GNAT sources are readily available, someone could have a look
and maybe try it. (Michael Feldman)
The best code would be generated if GNAT generated Java VM code
directly. An alternative approach that's simpler to implement,
though would have lower performance,
would be to have GNAT generate code for some "real"
machine and then write a Java program to emulate the machine. This
would be slower, but then all you need to write is an emulator that you
can compile into the Java VM.
If the time required to do a full-up GNAT generation turns out to be
too much, that's a backup plan. (David A. Wheeler)
Q: When can we expect a GNAT/GCC targeted for the Java VM?
A: As Robert Dewar is fond of saying, "as soon as someone writes one!" :-)
Note that there are already two commercial products that generate Java VM
output from Ada code:
AppletMagic by Intermetrics
ObjectAda by Aonix.
This page was originally submitted by David Wheeler.
Copyright © 1994-1996
by KSCE. All Rights Reserved.
Reproduction in whole or in part in any form or medium without
express written permission of KSCE is strictly prohibited.
Ada Home and Home of the Brave Ada Programmers are trademarks of KSCE.
For comments, additions, corrections, gripes, kudos, etc. please
or use the Ada Home feedback page.
Page last modified: 1996-12-17