Running JASTADDJ extensible compiler from Eclipse/IntelliJ
Up to The JastAdd Extensible Java Compiler (JastAddJ)
Hello Torbjörn,
I have been able to install the extensible compiler in intellij, by building 1.4 and 1.5 backends frontends. I then exported the project to eclipse, from where I could run the Javacompiler of the 1.4 Backend.
My Problem is that I have not been able to install the extensible compiler in eclipse directly without the aid of intellij. In the intellij exported project, there is one error that repeats "*** already defined", similarly even in intellij it shows too much red when you open individual java files. I am worried that although i have been able to run Javacompiler from the 1.5 backend, I can not add any further stuff to it. for example, i can not run CK metrics, because of all "already defined" errors in eclipse, and "class not found" error in intellij. I am trying to extend java with some functionality that is not too big but neither it is small, it will have some jrag files and some syntax extension, but I cant get it to work.
can you tell me a detailed procedure to install the extensible compiler with all back and front ends in one of eclipse or intellij? remember that the ant gen external tools does not help here, i have already done that. i want your help not for any jastadd project (i have been running smaller ones satisfactorily) but for the extensible compiler.
merlin
Re: Running JASTADDJ extensible compiler from Eclipse/IntelliJ
Hi Merlin,
This is a recipe for checking out JastAddJ using Subversion in Eclipse. You need to install Subclipse if you have already not done so. Instructions are available at http://subclipse.tigris.org/install.html
Start with an empty workspace. Open the "SVN Repository Exploring" perspective. Create a new "Repository Location..." using the context menu and the following URL: http://svn.jastadd.org/projects/trunk/JastAddJ
Select all four projects (Java1.4Frontend, Java1.4Backend, Java1.5Frontend, Java1.5Backend) and select Checkout in the context menu. This will checkout the static semantics checkers and compilers as projects in your workspace.
Each of the compilers can be built to generate a separate tool. You can build each tool by running the build.xml file in the each project using gen as target. You may want to take a look at http://jastadd.org/jastadd-reference-manual/running-jastadd-under-eclipse#ANT for further details on running Ant from within Eclipse.
An extension will import .ast, .jrag, .jadd files from the other projects using a relative path name (e.g., "../Java1.4Frontend/java.ast"). You therefore need to ensure that your extension is in the same folder as Java1.4Frontend, Java1.4Backend, etc. This also means that it is perfectly fine to close the projects you are not interested in, or do not want to build, as long as you keep the directory structure intact. If you are only interested in building you extension you can for instance close the other four projects if you do not want to build them.
Try to close all projects except Java1.5Backend, and run the build.xml ant file with the gen target. Make sure that the project is refreshed and that there is a generated folder AST with source files. This projects should now compile without errors and the JavaCompiler class is a Java 5 compiler.
Let me know if you run into any problems.
Cheers
Torbjorn