Skip to content
C++ to C++ code generation tool (enum2string conversion, serialization, reflection etc.)
C++ CMake Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmake Refactor build scripts Jul 14, 2018
include/meta Facilities for CRTPVisitor metaclass implemented Apr 15, 2019
src Fix code generation for inner statements Apr 18, 2019
test Fix code generation for inner statements Apr 18, 2019
thirdparty Implement C++ interpreter (2) Aug 24, 2018
.gitignore Initial commit Apr 12, 2018
.gitmodules Implement C++ interpreter (2) Aug 24, 2018
CMakeLists.txt Fix build under gcc Aug 27, 2018
LICENSE Update LICENSE Apr 12, 2018 [skip ci] Add build instructions Oct 29, 2018

Build Status Join the chat at

C++ code generation tool

Welcome to Autoprogrammer, the C++ code generation tool! This tool helps you dramatically reduce the amount of boilerplate code in your C++ projects. Based on clang frontend, the 'autoprogrammer' parses your C++ source files and generates new set C++ sources. For instance, it generates enum-to-string converting functions for you. Instead of you.

Table of contents


Historically, C++ (as a language) has got a lack of compile or runtime introspection, reflection and code injection. In consequence, the easiest task (for example, enum to string conversion) can lead the strong headache. The main purpose of 'autoprogrammer' tool is to eliminate this problem. Completely eliminate. This tool can be integrated in the build toolchain and produce a lot of boring boilerplate source code based on hand-written sources. For instance, can generate enum-string-enum conversion function. Or serialization/deserialization procedures. Or ORM mapping. Or static reflection helpers. And so forth, and so on. Currently, tool supports the following type of generators:

TODO list of generators to support:

  • Serialization/deserialization for boost and llvm::yaml
  • SQLite ORM
  • Helper implementations for popular static reflection libs

How it works

Autoprogrammer is a clang-based tool. It uses clang frontend for source code analyzes and bunch of Jinja2-like templates for the destination files production. Actually, 'autoprogrammer' compiles your hand-written source code, reflects it to internal structures and then produces new set of C++ source code files via corresponded generator. In order to process input files correctly, the whole set of compile options and definitions (and include paths as well) should be specified in the autoprogrammer command line.

How to use

sudo docker run --rm -ti autoprogrammer fl-codegen --help

How to build and install

With preconfigured docker

sudo docker build --tag autoprogrammer .

Manually on Linux



  • Clone this repository
  • Init and update all submodules (git submodule update --init --recursive)
  • Create the build directory (ex. mkdir .build-debug)
  • Run the CMake (cmake -DCMAKE_BUILD_TYPE=Debug ../)
  • Run the make (cmake --build . --target all)
You can’t perform that action at this time.