Brussels / 31 January & 1 February 2015


Common Lisp-Style Macroexpansion applied to C

A Code Generator from Lisp-Syntax to C-Syntax

We describe a new free software project, called CGen [name might change], a C code generator with support for Common Lisp-style macro expansion. It is based on a new S-Expression based Syntax for C (and C-like languages) which is transcompiled to C (or C-like) code. Our code generator supports the simple and efficient management of variants, ad hoc code generation to capture reoccurring patterns, composable abstractions as well as the implementation of embedded domain specific languages by using the Common Lisp macro system. We demonstrate the applicability of our approach by numerous examples from small scale convenience macros over embedded languages to real-world applications in high-performance computing.

After successful presentation at ELS in 2014 we decided to polish our research prototype and make it available as free software.

For a full description we would like to refer to the attached paper, which was accecpted and presented at ELS this year.


Kai Selgrad