Aburiscript
Aburiscript (pronounced Eh-bree-script) is a C and C++ frontend and compiler driver written in C++. It currently emits LLVM IR, supports a broad subset of C, and is growing C++ support including classes, polymorphism, exceptions, RTTI, and templates.
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 standard library 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 variadic 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++ standard library 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 large, widely used C projects such as 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. Validation ranges from compile/link checks to version and runtime smoke tests. A subset of these programs are tested in GitHub CI.
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 macOS aarch64 (Apple Silicon). Linux aarch64 support is planned. 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.
Parts of the project were built with AI-assisted tooling under human review. See the note on AI-assisted development in the documentation for more information.
Future goals
As of now, Aburiscript is not a Clang or GCC replacement. The short term goals are to fix mis-compiles/incorrect codegen, add more C++ features and support compilation of the C++ standard library. Medium/long term goals include self-hosting, a custom backend, and performance/compile time optimizations.