conferences | speakers | series

C meta-programming for the masses with C%: cmod

home

C meta-programming for the masses with C%: cmod
FOSDEM 2022

C% (from "C with mods") is an experimental meta-programming language that aims to make coding in C more efficient and fun!

Together with cmod, the reference pre-processor/code generator (written using C% itself), this project enables the C programmer with generic meta-programming constructs such as: parameterized verbatim code snippets, mapping code to static data tables (in TSV or JSON format), multi-pass code evaluation (allowing meta-meta-programming), compile-time command execution (allowing code generation from any other software/language), etc. as well as C-specific constructs such as: function types, named parameters, selection over strings and structs, etc. The C% standard library provides convenience constructs for inclusion in C programs.

Some of the things that C% aims to make achievable are:

  • Reusability: Avoid code duplication.
  • Consistency: Use the same data across different locations.
  • Efficiency: Perform common tasks quick and easy.
  • Concision: Write and work with concise code.
  • Expressivity: Better express the intent of code.
  • Transparency: Hide nothing from the programmer.
  • Abstraction: Handle similar things in a uniform manner.
  • Extensibility: Easily add new functionality.
  • Simplicity: Keep the language simple but powerful.

All while keeping with the spirit of C: trust the programmer and don't prevent the programmer from doing what needs to be done!

Beyond C meta-programming, C%'s generic keywords enable meta-programming in other languages such as Python, Flex/Bison, etc.

For full documentation, please refer to the README.

Speakers: Sirio BolaƱos Puchet