Skip to content

serjective/aburiscript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

113 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Aburiscript C/C++ Compiler

Welcome to the repo for the Aburiscript (pronounced Eh-bree-script) compiler. Aburiscript is a C and C++ frontend that currently outputs LLVM IR and is designed to support standard C features, various extensions (like blocks and attributes), and a growing subset of C++ features including classes, polymorphism, templates, and exceptions.

Aburiscript can currently compile many of the world’s top C projects, including chibcc, OpenSSL, Git, SQLite, PostgreSQL, FFmpeg/librempeg, gstreamer, libplacebo, mpv, QEMU, Ghostscript, zlib, and zstd. It can also compile and run many compiler test suites such as the GCC torture suite.

The project is still very much in development, and a compiler backend implementation is planned soon (which would remove LLVM as a hard dependency) along with many other features (more info in Future plans).

The name of the project comes from the town of Aburi, Ghana and its botanical garden.

More information can be found at the Aburiscript home page and in the documentation in this repo.

Note about AI/LLMs

(This section is completely written by me)

Note that 99.99999% of the code in ast2llvm/ was generated by AI coding tools (I remembered I wrote about 10-50 lines in that module back in December relating to extern variables), along with most of the documentation, as the ultimate goal is my own custom backend. I do review all of the code: however anything in ast2llvm has gotten significantly less attention from me. Other parts may have some AI code contains within but in wildly varying amounts, with more scrutiny.

I still have done a lot of work reading books about C++ such as C++ Templates: The Complete Guide, the C/C++ standards, and other important references. There is a public test suite and all the sample_c and sample_cpp programs work on my Macbook with Mac OS 26. The CI/CD harness has artifacts anyone can verify ("Actions" tab). The compiler is explicitly a WIP, something that would be true regardless of how it was built, given the scope. I prefer to spend my time writing or fixing code LLM can not write/fix as it's simply a better use of my time. With a compiler of this size many such opportunities abound. A longer post on the exact workflow is coming.

I am deciding to use LLMs because I have written smaller compilers before LLMs and many industry leaders in compilers and computing in general (not singling anyone out: use a search engine or LLM) are embracing this technology and integrating it into this workflow heavily. In my view, LLMs amplify expertise rather than replace it. I do not think anyone with no compiler knowledge could make this project purely with current-day LLMs.

Quick Start

For a short path from build to first executable, including runnable example programs under sample_c/ and sample_cpp/, see the Quick Start Guide.

Prerequisites

  • CMake 4.1 or higher
  • LLVM 18.x (configured via LLVMConfig.cmake). I developed with 18.1.8 and don't know if lower or higher versions of LLVM 18 will change behavior.
  • A C++20 compatible host compiler

Building from Source

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DLLVM_DIR=/path/to/llvm-18/lib/cmake/llvm
cmake --build build

If you prefer llvm-config, use the one that belongs to LLVM 18, or pass -DCMAKE_PREFIX_PATH=/path/to/llvm-18 instead. See the Build and Dependency Guide for the supported LLVM policy and release packaging guidance.

The default configure path builds the compiler only. To enable the public runtime smoke suite under public_tests/, add -DABURI_BUILD_PUBLIC_TESTS=ON.

Running Tests

The public runtime smoke suite is driven by CTest. Once configured with -DABURI_BUILD_PUBLIC_TESTS=ON, run:

ctest -R public_tests_runtime

This check compiles and runs each sample in public_tests/.

Features Overview

C Support

  • Standard control flow and operators.
  • Pointers, arrays, and Variable Length Arrays (VLAs).
  • Structs, unions, and bitfields.
  • Enums.
  • Variadic functions.
  • GCC/Clang extensions like __attribute__((packed)), __builtin_offsetof, etc.
  • Apple Blocks (^).
  • C11 features like _Static_assert, _Alignas, and _Thread_local.
  • C99 _Complex and compound literals.

C++ Support (In Progress)

  • Classes and structs with access control.
  • Member functions (methods), constructors, and destructors.
  • Single and multiple inheritance with virtual methods (polymorphism).
  • Pointers to members.
  • Exceptions (try, catch, throw).
  • Dynamic allocation (new, delete).
  • Templates (partial support).

Documentation

License

Aburiscript is dual-licensed under either the Apache License, Version 2.0 or the MIT License, at your option. See LICENSE, LICENSE-APACHE, and LICENSE-MIT.

Packages

 
 
 

Languages