- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Jimple to C# (proof-of-concept) translator
Sat, 2010-03-06, 11:47
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...