This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Extending Scala

3 replies
Olivier Pernet
Joined: 2010-03-13,
User offline. Last seen 42 years 45 weeks ago.

Hi all,

I'm a PhD student at Imperial College London, working on session
types. I'm considering implementing multiparty session types as an
extension of Scala.
This would require new syntax (probably), and changes to the type
system (or another, separate type system implemented as a later pass).

One of the things that prompted me to consider extending Scala is the
compiler plugins facility. But does this support extending the
language with new syntax? The introductory webpage says:

* You can add a phase to the compiler, thus adding extra checks or
extra tree rewrites that apply after type checking has finished.
In the case of adding new syntax, I imagine I would need to do tree
rewrites before (standard Scala) type checking. Is this supported?

Finally, do you know of any other Scala extension projects? Is there a
repository of compiler plugins somewhere?

I avoided explaining about session types to keep this email short, but
feel free to ask if you're curious.

Olivier Pernet

We are the knights who say
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Extending Scala
Last time I asked, I was told that plugins only got in after lex/parser.

On Sat, Mar 13, 2010 at 7:57 PM, Olivier Pernet <omp08 [at] doc [dot] ic [dot] ac [dot] uk> wrote:
Hi all,

I'm a PhD student at Imperial College London, working on session
types. I'm considering implementing multiparty session types as an
extension of Scala.
This would require new syntax (probably), and changes to the type
system (or another, separate type system implemented as a later pass).

One of the things that prompted me to consider extending Scala is the
compiler plugins facility. But does this support extending the
language with new syntax? The introductory webpage says:

* You can add a phase to the compiler, thus adding extra checks or
extra tree rewrites that apply after type checking has finished.
In the case of adding new syntax, I imagine I would need to do tree
rewrites before (standard Scala) type checking. Is this supported?

Finally, do you know of any other Scala extension projects? Is there a
repository of compiler plugins somewhere?

I avoided explaining about session types to keep this email short, but
feel free to ask if you're curious.

Olivier Pernet

We are the knights who say
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc



--
Daniel C. Sobral

I travel to the future all the time.
Miguel Garcia
Joined: 2009-06-10,
User offline. Last seen 42 years 45 weeks ago.
Re: Extending Scala

"Olivier Pernet" wrote
> This would require new syntax (probably)

The SID describing how the compiler sees type annotations may help
http://www.scala-lang.org/sid/5

> Finally, do you know of any other Scala extension projects? Is there a
> repository of compiler plugins somewhere?

Not really but the closest that comes to my mind is
http://www.sts.tu-harburg.de/people/mi.garcia/ScalaCompilerCorner

Miguel

Miguel Garcia
Joined: 2009-06-10,
User offline. Last seen 42 years 45 weeks ago.
Re: Extending Scala

"Miguel Garcia" wrote
> The SID describing how the compiler sees type annotations may help

I forgot to mention that the compiler accomodates custom processing of
(custom) annotations by subclassing
http://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/compiler/scala...

I guess the implementation effort would be much lower as compared to
Polyglot, which always forces to extend the surface syntax (or so I
understood from your previous prototype,
http://www.doc.ic.ac.uk/~rhu/sessionj.html )

Miguel

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland