The Squid and dbStage Projects


In this project, we aim to facilitate the design of efficient but maintainable software systems. We rely on metaprogramming to generate code and mechanically remove abstractions, using domain-specific optimizations. To achieve this with maximal convenience and reliability, we focus on type-safe approaches tightly embedded in the Scala programming language.


Squid (for the approximative contraction of Scala Quoted DSLs) is a metaprogramming framework that facilitates the type-safe manipulation of Scala programs. Squid extends multi-stage programming capabilities with support for code inspection and code transformation. It has special support for library-defined optimizations and helps with the compilation of domain-specific languages (DSL) embedded in Scala. Squid uses advanced static typingtechniques to prevent common metaprogramming errors, such as scope extrusion.

The source code is available on github.


With dbStage, we use Squid to design a novel language-integrated modular database system relying on multi-stage programming (staging) and DSL optimization in order to remove abstraction and regain optimal performance (i.e., abstraction without regret). The emphasis is on programmer convenience, robustness and correctness aided by Scala’s advanced type system.

The project is still in its early stages, but we already have various working prototypes.

The source code is available on github.


  • Christoph Koch
  • Lionel Parreaux
  • Amir Shaikhha


This project is supported by NCCR MARVEL.