Hadron is a statically typed system programming language compiler targeting the LLVM backend. It supports C++23 standards and utilizes LLVM 21 for code generation.
The following dependencies are required to build the compiler:
- Operating System: Linux
- C++ Compiler: Clang 21 (Must support C++23)
- Build System: CMake 3.25 or higher
- Generator: Ninja
- LLVM: Version 21 (Development libraries required)
- Standard Library:
libstdc++(Default) orlibc++
The project uses CMake. A Makefile wrapper is provided for convenience.
To build in Debug mode (with AddressSanitizer and UndefinedBehaviorSanitizer enabled):
make debug
To build in Release mode (Optimized, no sanitizers):
make release
To clean build artifacts:
make clean
Configure the project:
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_DIR=/usr/lib/llvm-21/lib/cmake/llvm
Build the executable:
cmake --build build --parallel $(nproc)
The compiler binary hadronc is located in the build directory.
./build/hadronc <input_file> [options]
-o <file>: Specify the output binary filename. Default isa.out.--emit-ir: Print the generated LLVM IR to stdout.--dump-asm: Display the generated assembly code usingobjdump.--keep-obj: Retain the intermediate object file (.o) after linking.
Unit tests use the GoogleTest framework (fetched automatically via CMake).
To run the test suite:
make test
Or manually via CTest:
cd build
ctest --output-on-failure
The project uses clang-format. To format all source files:
make fmt
Refer to SECURITY.md for vulnerability reporting policies.
This software is licensed under the MIT License. See the LICENSE file for details.