April 01, 2008Looking beyond languagesI remember the first time I used a Java decompiler... I picked a random class file, fed it to the decompiler and sat in amazement as the tool spit out Java code that was almost identical in all parts to my original source code. Ever since I saw that, I have always wondered how hard it could be to create a tool that would output something else than Java... Would it be possible to have a program that could translate Java into pretty much anything? It turns out that it's quite possible. For the past couple of years, I and a few other people have been working at just that. The idea is to provide an API that makes it easy to read bytecode in a form that's relatively structured (identifiying method and class names, iteration structures, etc...) so that developers can easily generate source code for whatever language they feel like. I'm very happy to announce an initial release of project Toledo. Toledo is a very ambitious project that's made of three parts:
I'm not going to dive deep into details with this post, but I will certainly do so in the next few months in this blog. Before I point you to the project's page, I'd like to thank some of the people without whom Toledo would never have happened:
For more details, go to the Project Toledo's home page and please send your feedback! Comments
But stuff like this already exists (Reflector?). So why bother creating an April Fools? Posted by: RichB at April 1, 2008 09:43 AMJeebus Cedric, don't you know Rick Astley is a Rails guru now. I'd rather see the Clash youtube.com/watch?v=0Ag8J2NMYmc Posted by: Frank Bolander at April 1, 2008 10:24 AMI smiled anyway. :-) In all seriousness, it turns out that things like this are more complicated than they would seem. For example, have you ever tried feeding AspectJ's output through a decompiler? Bytecode supports far more powerful constructs than Java (or many other languages for that matter). The only thing which allows reverse compilation to Java source is that the bytecode itself *originally* was produced from such sources. You would have a much easier time translating directly from Java into the target language. Nice thought though... Posted by: Daniel Spiewak at April 1, 2008 10:25 AMyou sob....I had successfully avoided having this happen to me until now. nice Posted by: jesse kuhnert at April 1, 2008 11:14 AMProps on the project name! Don't forget the Parrot story (developers.slashdot.org/article.pl?sid=01/03/28/1742237) Posted by: Andres Almiray at April 1, 2008 12:05 PMI did click on the link :) Don't know what it is saying about me... Good one, Hehe. When you see JavaScript and C/C++ in the same context you gotta know something is fishy :) Posted by: Cosmin Marginean at April 1, 2008 11:35 PM:) Today being April 8th and all, I clicked on that link twice before I caught on. I just read this today (22 of April), not noticing the date. So I didn't realize it was an April fool: I was ready to call my co-workers/CEO saying 'check this out, this is similar to what we're doing'. And, yup, we're converting bytecode back to source files in other language (C++ and Objective-C) that are then instantly compiled on various platforms. I won't go into the details but our clients are paying mucho bucks for this technology and we're not the only company doing this. Automatic conversion from language 'x' to language 'y' has been a reality since many years. We happen to build non-Java source from 'java' bytecode (others company are doing this too). So it's not really an April fool. This technology is very real. I got fooled today and I was also about to post the link to "Toledo" to coworkers. We are doing exactly what you describe to port Java code to IL and to use it from C#, VB and managed C++. You did a great job to fool people but sorry, I didn't get the joke part of the post. Posted by: Carl Rosenberger at April 28, 2008 05:26 AMPost a comment
|