Are you an EPFL student looking for a semester project?
Work with us on data science and visualisation projects, and deploy your project as an app on top of Graph Search.
A metaprogrammer should be able to reason about the semantics of the generated code.Multi-stage programming introduced an elegant and powerful solution to this problem.It follows a semantically driven approach to code generation, where semantics are fully defined by the metaprogram and cannot accidentally change when we generate the code.This implies that the generated code is well typed and hygienic by construction.We can apply this principled semantic approach to other metaprogramming abstractions.However, different metaprogramming abstractions have different levels of expressiveness.Usually, the more expressive abstractions are more complex and give fewer static guarantees.It is hard or impossible to find a single abstraction that is both simple and fully expressive.Instead of choosing a single abstraction, we can design a single system out of several abstractions that scale with respect to expressiveness and complexity.We must be careful with the most expressive metaprogramming abstractions, as they may expose parts of the compiler or of its code representations, which hinders portability.We demonstrate that it is possible to design, implement and use in production a Portable Scalable Semantically Driven Metaprogramming System.
Martin Odersky, Nicolas Alexander Stucki, Jonathan Immanuel Brachthäuser