Friday, 26 February 2016

Scala Compiler (scalac) Phases in Scala 2.11.7


In this post, we are going to discuss about what are the phases available in Scala Compiler in Scala Version 2.11.7.

These phases are different in different Scala Versions. We will take latest version of Scala and look into them now.

Scala Compiler Phases in Scala 2.11.7:

As We know, scalac command is used to compile Scala programs. It is known as Scala Compiler.

We use '-version' option to know the Scala Version.

F:\Training>scalac -version
Scala compiler version 2.11.7 -- Copyright 2002-2013, LAMP/EPFL

In the same way, we can use '-Xshow-phases' option to know the available scalac phases. As shown below, Scala 2.11.7 has total 25 phases.

Each phase is responsible to do one specific functionality. If we observe those phases, the last but one phase is responsible to generate JVM Byte code because before doing this phase scalac does many stuff to add or convert things from Scala components into JVM components.

Please drop me a comment if you like it or have any issues or suggestions.

Thank you.