Hi, In case you've been looking for a low-level IR for Scala ASTs, now you can inspect and transform a three-address-like IR (which are also valid Scala ASTs) emitted by a compiler plugin to that effect.
Sample input: object Test { def main(args: Array[String]) { val res = if(b(1) + b(2) * b(3) > 0) { throw new Exception; "thenBranch" } else { "elseBranch" } } def b(n: Int) = { scala.Console.println(n); n } } Sample output (excerpt): def main(args: Array[java.lang.String]): Unit = { var tmp10: java.lang.String = _; val tmp1: Int = Test.this.b(1); val tmp2: Int = tmp1; val tmp3: Int = Test.this.b(2); val tmp4: Int = tmp3; val tmp5: Int = Test.this.b(3); val tmp6: Int = tmp4.*(tmp5); val tmp7: Int = tmp2.+(tmp6); val tmp8: Int = tmp7; val tmp9: Boolean = tmp8.>(0); if (tmp9) { val tmp11: java.lang.Exception = new java.lang.Exception(); throw tmp11; tmp10 = "thenBranch" } else tmp10 = "elseBranch"; val res: java.lang.String = tmp10; () } The PDF at http://lamp.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/2011Q2/Moving3A.pdf is the technical documentation for the sources at http://lampsvn.epfl.ch/trac/scala/browser/scala-experimental/trunk/imp/src If you want to use this plugin *today*, please notice [1] (that came to light during the development of this plugin). Alternatively, the plugin sources show how to workaround that. Comments and suggestions are welcome (at http://groups.google.com/forum/#!forum/scala-internals). Miguel http://lamp.epfl.ch/~magarcia/ScalaCompilerCornerReloaded [1] http://issues.scala-lang.org/browse/SI-4738 -- You received this message because you are subscribed to the Google Groups "JVM Languages" group. To view this discussion on the web visit https://groups.google.com/d/msg/jvm-languages/-/97SU84YO8ykJ. To post to this group, send email to jvm-languages@googlegroups.com. To unsubscribe from this group, send email to jvm-languages+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en.