Thursday, December 6, 2007

Scala for PL geeks^W researchers

Scala makes for a great language to experiment with programming language design. In my upcoming posts, I'll address applications such as:

  • parsing I'll explain how to get your parser up and running in no time, without resorting to external tools. Scala comes with an easy to use library of parser combinators, which means there's no extra tool to integrate in your build process, no weird generated code to debug, and no new language to learn. Well, that last part is a bit of a fib, as the library of parser combinators essentially implements a domain-specific language in Scala itself!
  • variable binding and substitution Getting substitution right is trickier than most people think. We'll look at a library that encapsulates all this, and which integrates nicely with Scala's parser combinators to express variable scoping right in your language's grammar.
  • type-checking We'll see how you can "port" the inference rules that define your type system from paper to Scala, with most of the boilerplate hidden underneath the covers of a type-checking monad.
My colleagues and I are happily using these libraries, and I hope to convince you to do the same (once I get around to documenting them and preparing them for release ;-) -- RSN!).