Question

In the GCC compiler we see several 'intermediate languages': RTL, GENERIC and GIMPLE.

This answer hints at the idea of an intermediate representation in scalac.

My question is: is there an 'intermediate representation' of the compiler in Scala? Is there any documentation for this?

Assumptions:

  • I don't mean JVM byte code. I mean the level of abstraction above that.
Was it helpful?

Solution

The nearest equivalents would be icode and bcode as used by scalac, view Miguel Garcia's site on the Scalac optimiser for more information, here: http://magarciaepfl.github.io/scala/

You might also consider Java bytecode itself to be your intermediate representation, given that bytecode is the ultimate output of scalac.

Or perhaps the true intermediate is something that the JIT produces before it finally outputs native instructions?

Ultimately though... There's no single place that you can point at an claim "there's the intermediate!". Scalac works in phases that successively change the abstract syntax tree, every single phase produces a new intermediate. The whole thing is like an onion, and it's very hard to try and pick out one layer as somehow being more significant than any other.

OTHER TIPS

maybe this will help you out:

http://lampwww.epfl.ch/~paltherr/phd/altherr-phd.pdf

or this page:

www.scala-lang.org/node/6372‎

According to Iulian Dragos' thesis, the backend uses an intermediate representation called icode. You can read more about it here http://infoscience.epfl.ch/record/150270/files/EPFL_TH4820.pdf on page 34.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top