Skip to content

prasanna-28/clac.rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This is a compiler for the stack-based programming language CLAC. It generates x86 assembly code for Linux systems.

Requirements

  • Rust
  • NASM
  • gcc

Usage (automatic compilation is unfinished)

  1. Write your CLAC source code

  2. Run the CLAC compiler using the following command:

cargo run main.clac

This will generate an assembly file named output.asm.

  1. Assemble the generated assembly file using NASM:
nasm -f elf64 output.asm

This will produce an object file named output.o.

  1. Link the object file using the GNU linker:
gcc -no-pie -o output output.o

This will create an executable file named output.

  1. 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.

About

rust compiler for CLAC

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published