Monday, August 29, 2011

Proteus Cross Compiler and the LLVM Compiler Infrastructure

There is a new (6 days old) project on SourceForge that really piqued my interest: the Proteus Cross Compiler.  The project boasts the ability to generate Java code from GCC compatible languages such as C, C++, and Fortran.  Having had experience compiling C to MIPS assembly by hand, I began poring through the project home page and documentation.

At first, I was doubtful.  Many would-be language converters that I have looked at in the past failed at the insurmountable task.  What could make this project an exception?  I was pleasantly surprised to find that the task was reduced in complexity by taking advantage of another interesting, well-established project: the Low Level Virtual Machine (LLVM) compiler infrastructure.  The LLVM project takes care of the various GCC language front-ends, and spits out an optimized intermediate form which is then used by Proteus to generate Java code.  Thus, in a way, Proteus is just an LLVM to Java converter.

After being convinced of the reduced complexity of the task, I was quick to start setting up my environment to test out the system!  Looking through the worked-out examples, I figured it was best to try it on my Ubuntu virtual machine instead of directly on my OS X Lion, which would require me to manually compile many dependent packages.  On Ubuntu, installing the supporting LLVM and GCC front-end was really easy:

sudo apt-get install llvm-2.7 llvm-gcc-4.5

Finally, it is time to play!  I clicked on the "files" section to download the project, and the only thing there is a "readme.txt" file.  The 6-day old project does not have the files uploaded yet...  I guess we will just have to check it out next time!

One closing trivia: is anyone aware that Apple is using LLVM?  Check it out: http://developer.apple.com/technologies/tools/

1 comments:

Toy said...

Apple started pushing for LLVM as early as 2005 and started using it on OS X 10.5 Leopard in 2007.

Post a Comment