Copyright © 2004 Stoney
Distributed under the LGPL
See: http://peephole.cs.ucdavis.edu/
Copyright © 2000 Greg J. Badros, <gjb@cs.washington.edu>
Distributed under the LGPL
See: http://www.badros.com/greg/JavaML/
Copyright (C) 1996, 1999 International Business Machines Corporation and others. All Rights Reserved.
Distributed under the IBM Public License Version 1.0.
Greg Badros’s JavaML is an XML representation for Java abstract syntax trees (AST). Badros also created a tool for translating java code into JavaML. This tool is modification of the jikes Java compiler. The JavaML translator supplied in this package is also a modified version of jikes, but a more recent version of jikes than Badros’s original translator. The JavaML produced conforms to JavaML DTD 0.97, which resides in the bin directory of the instillation (e.g., c:\javaml\bin).
1) This distribution ships with jikes binaries for various OSs and architectures. Find the binary for your OS and architecture in a folder with the appropriate name within the bin directory (e.g., bin/win32-x86). If you can’t find your OS and architecture, you’ll need to compile jikes from its source. If this is the case extract javaml-1.18-src.tar.bz2 and follow the compilation instructions below.
2) Copy or move jikes from the directory corresponding to your OS and architecture the bin directory.
$ cp bin/linux-x86/jikes bin
Or if you compiled jikes from source…
$ cp javaml-1.18-src/src/jikes bin
3)
Add full path to bin to your path.
4) Add rt.jar (in your jre’s lib directory; e.g., /usr/lib/java/jre/lib/rt.jar) to your CLASSPATH. This is required by Jikes.
This process had become more complicated because of recent compiler changes. From the javaml-1.18 directory, first try the following:
$ ./configure --enable-debug
$ make all
If you get a compiler error on xml-unparse.cpp, then edit the Makefile in the src directory and change the following line
CPPFLAGS =
to read as
CPPFLAGS = -fpermissive
Now, return to the javaml-1.18 directory and run “make all” again.
When jikes is used to “unparse” XML from source files, it creates an xml-unparsed directory that contains all of the xml files. The xml-unparsed directory is located in the directory from which you launched jikes. However, the peephole tools expect the xml-unparsed directories to be under the directory that contains the file that was unparsed. For example, if you unparsed mydir/Test.java, its xml file would be mydir/xml-unparsed/Test.java.xml. To coerce this behavior, we wrote a bash script and a Windows batch script named javaml and javaml.bat. You should use these scripts when unparsing for use with our peephole tools.
To unparsed all the java files in the current directory:
$ javaml *.java
Warnings and errors may be reported by jikes, but it should still be unparsing XML. You can verify the success of JavaML by examining the XML files it produces in the xml-unparsed directory.