This is a compiler for the stack-based programming language CLAC. It generates x86 assembly code for Linux systems.
- Rust
- NASM
- gcc
-
Write your CLAC source code
-
Run the CLAC compiler using the following command:
cargo run main.clac
This will generate an assembly file named output.asm
.
- Assemble the generated assembly file using NASM:
nasm -f elf64 output.asm
This will produce an object file named output.o
.
- Link the object file using the GNU linker:
gcc -no-pie -o output output.o
This will create an executable file named output
.
- Run the compiled program:
./output
Example main.clac, and output.asm can be found in /clac/. Note that if your output.asm is not updating, you may need to delete before cargo run.