Charles Explorer logo
🇬🇧

Translating Lambda Calculus into C++ Templates

Publication at Faculty of Mathematics and Physics |
2021

Abstract

The C++ template system is capable of performing arbitrary compile-time computations, which is typically exploited in generic programming libraries. However, the template language itself is syntactically cumbersome.

A variety of tools, ranging from libraries to dedicated compilers, was created to alleviate this issue. One such approach is translating a functional program into a template metaprogram.

In this work, we present a new way of translating functional programs based on lambda calculus into template metaprograms. The translation produces metaprograms with clearly defined lazy semantics and supports common functional features such as recursion and algebraic data types.

We demonstrate its viability by providing a proof-of-concept implementation.