Compiler of the Alan programming language, developed for the 8th semester's Compilers course at NTUA.
Instructions for building in Debian here
The project contains 3 subdirectories (sub-crates).
- alan: The compiler backend for the Alan language
- alanc: The cli frontend of the compiler
- stdlib: The Alan standard library, written in C (which at it's current state relies on libc, so we can target every platform &/ architecture)
(Not as detailed as IKEA's)
Pre-build linux binaries are available, in the actions tab.
A pre-configured Dockerfile and an image in docker-hub that is (somewhat) tested can be used to easily build and test the project.
The project is tested on rustc 1.82.0-nightly
.
At the time of writing a nightly version is required.
The project is requires and pre-configured to use LLVM 18.
If llvm is not in the default path LLVM_SYS_180_PREFIX
should be set.
If you want to use any other version of llvm, Cargo.toml the build.rs and Makefile should be edited accordingly.
In addition, llvm-sys will try to link llvm statically, (platforms such Arch will be built with dynamic llvm libraries)
In sort, in order to fully build and run the compiler. The following should be available:
- llvm-config
- llvm-as or llvm-as-18
- clang or clang-18
Also (for compiling the stdlib):
- make
Clone the project
git clone https://github.com/avramidis-stavros-compilers-org/compilers-mirror.git
Go to the project directory
cd compilers
Run with cargo
cargo run alanc --release -- <Program arguments>
Build with cargo
cargo build --release
Warning: By default x86 release builds are build for x86_64_v3 (avx,avx2) with lto
If you want to install the alanc globally:
cargo install
Run the program with -h/--help
and you'll learn everything you need to know, on how to use it.
Run it with --version
, if you want to chase some dragons.
-
Cross Compilation (yes, you can compile for CUDA 🙌)
-
(Ridiculously) fast lexing, using Logos
-
Errors made for humans, thanks to chumsky parser combinator + ariadne
- Parsing lower bound negative integer (f.ex -2147483648 for 32b ints)
- Cross compilation (partially working)
Copyright 2024 Stavros Avramidis