- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
the things the Scala compiler does to the mind
Wed, 2009-12-30, 15:27
Hi,
I've revamped the "Project Ideas" section (for an *excerpt* see below) at
the homepage where I track resources on the Scala compiler:
http://www.sts.tu-harburg.de/people/mi.garcia/ScalaCompilerCorner/
There's no way I'll find time to work on any of these projects (as much as I
would like). It would be great to know about other efforts in these and
similar areas.
Miguel
Bytecode Contracts:
-------------------
Scala's bytecode generation [1] could be extended to generate BML
annotations [2], for consumption by a program verification tool (an
IDE-based editor [3] is also available). This sounds like the
JVM-counterpart of Microsoft's CodeContracts [4]. Some BML expressions can
be generated from Scala expressions, others from an encoding of BML as an
embedded DSL [5].
Export and Import of ASTs:
--------------------------
In principle, AST processing can be expressed more easily with Stratego-like
constructs, as supported by Kiama [6]. Given that the internal
representation of Scala ASTs has been optimized for speed (same as in Java
compilers), a conversion is necessary (as reported in Fusing a
Transformation Language with an Open Compiler [7]). Admittedly, there are
pros and cons to both the term-rewriting and the graph-rewriting styles. The
X10 compiler has built-in support to export/import ASTs.
Type lattice visualization:
---------------------------
Rather than trying to understand head-on how the typechecker works ;-) it
might be useful to visualize first what the typechecker does for a given run
(which type lattice it computes). At least one other component of the Scala
compiler generates a DOT file to illustrate its operation
(-Xgenerate-phase-graph). In IDE-speak, a type lattice is called a "UML
Class Hierarchy". Actually, it need not be IDE-based: Scaladoc2 could be
retrofitted to perform code-summarization as in Spinelli's UMLGraph [8].
Typestate analysis for Scala:
-----------------------------
It would be interesting to know whether declarative points-to analyses
(paper [9] and source code [10]) can scale up when object abstractions track
typestates. There are different expressiveness levels for typestate
properties, all sharing the limitation to temporal safety (no liveness).
Recent work includes analyses for socket-style APIs [11], as well as for
more elaborate API protocols (e.g., JDBC) [12].
A framework for pluggable type systems:
---------------------------------------
As discussed in thread [13]
References:
-----------
[1]
http://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/compiler/scala...
[2] http://www-sop.inria.fr/everest/BML/
[3] http://www.mimuw.edu.pl/~alx/umbra/
[4] http://research.microsoft.com/en-us/projects/contracts/
[5] http://phoenix.labri.fr/DSPD/final/dubochet2006zytyg.pdf
[6] http://code.google.com/p/kiama/
[7] http://www.ii.uib.no/~karltk/phd/papers/ldta07-pomadapter.pdf
[9] http://martin.bravenboer.name/docs/issta09.pdf
[10] http://doop.program-analysis.org/index.html
[11] http://www.cs.cmu.edu/~aldrich/papers/savcbs64-kim.pdf
[12] http://www.cs.cmu.edu/~kbierhof/papers/permission-practice.pdf
[13] http://comments.gmane.org/gmane.comp.lang.scala.internals/2673