This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Jimple to C# (proof-of-concept) translator

No replies
Miguel Garcia
Joined: 2009-06-10,
User offline. Last seen 42 years 45 weeks ago.

Today's write-up [1] closes the chapter on the low-level, 3-address
representation of instructions that I've been drumming about for a few weeks
now. That's the kind of intermediate representation that a compiler backend
could manipulate (for example, another backend for scalac).

Given that there's as of now no 3-address form for ICode, I took the liberty
of fabricating the setting for an experiment, where Soot is used to obtain
Jimple from the bytecode of Scala programs. Afterwards, the proof-of-concept
translator [2] takes that Jimple and outputs C#. The output does not compile
(as you can imagine) because the Scala programs at my disposal all contain
JDK API calls. But you get the idea. In a nutshell, recovering high-level
control structures (for exception handling and locking) from their Jimple
version required no big effort. In fact, after proper refactoring, the
prototype could *even* be useful in connection with the .NET version of
scalac.

Long live 3-address form! :-)

Miguel

[1]
http://www.sts.tu-harburg.de/people/mi.garcia/ScalaCompilerCorner/GenCSh...
[2]
http://www.sts.tu-harburg.de/people/mi.garcia/ScalaCompilerCorner/code/j...

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland