Aburiscript (pronounced Eh-bree-script) is an in-development C/C++ compiler written in C++ currently targeting Linux and macOS and currently uses LLVM for code generation.

What’s supported:

  • Basically all of C99
  • Many/most C11/C17/C23 features: _Bool, _Noreturn, _Static_assert (including C23 parameterless form), _Alignof / _Alignas, _Thread_local, and type-generic math with _Generic.
  • GCC/Apple extensions - builtins, statement expressions, attributes, basic and extended __asm__ blocks, Apple blocks extension (used by Apple stdlib headers and Mac OS UI code in projects like mpv)
  • “simple” C++ classes/struct constructs - including virtual functions, constructor/deconstructors (ctors/dtors), and out of line declarations
  • Exception handling (Itanium ABI)
  • Basic template support (features like varadic templates and member templates are very much WIP)
  • Error recovery and diagnostics
  • Clang-like detailed AST for tasks like static analysis
  • And more…

While C support is quite comprehensive, there is still a lot of work left to be done for relatively complete C++ support. In particular, the template subsystem needs more work and the C++ stdlib does not compile with Aburiscript yet. Move semantics (required for std::unique_ptr, std::shared_ptr) are currently unimplemented.

The sample_c and sample_cpp folders in the repo have examples of C and C++ programs that compile successfully under Aburiscript.

Aburiscript can currently compile many of the world’s most advanced and important C projects/code, including chibcc, OpenSSL, Git, SQLite, PostgreSQL, FFmpeg/librempeg, gstreamer, libplacebo, mpv, QEMU, Ghostscript, zlib, zstd, and more (tested with Apple libc). It can compile and run most of the GCC torture suite.

The name of the project comes from the small town of Aburi in Ghana and the beautiful botanical gardens located within.

Development and Testing

This project was primarily developed and tested on Mac OS aarch64 (Apple Silicon). Linux aarch64 support should be coming soon. I do not have reliable access to an x64 machine, therefore progress on adding support for x64 (while LLVM does support x64, frontend support for ABI-dependent features like bitfields needs to be implemented for each architecture/OS) might be slowed.

The project has a public test suite consisting in public_tests. In addition, the compiler is tested against real world programs in the CI.

Future goals

The short term goals are to fix mis-compiles/incorrect codegen, add more C++ features and supporting compilation of the C++ stdlib. Medium/long term goals include self-hosting, a custom backend, and performance/compile time optimizations.

Download

Github link

.tar.gz of v0.1 release