Skip to content

a smol compiler I've been working on for the past few weeks

License

Notifications You must be signed in to change notification settings

japrozs/rim_llvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rim llvm

Rim is a tiny compiler that I've been working on for the past 2 weeks. Right now it just compiles the code to llir but I'm need to add a lot of stuff to it.

Usage

# make sure you have llvm installed
$ git clone https://github.com/japrozs/rim_llvm.git
$ cd rim_llvm
$ make -j$(nproc)
$ ./out/rimc samples/basic.rm

Example

samples/basic.rm

fn my_fn(argument, list){
	let var_inside_function : int = 123;
}

let declaration : string = "this is a global constant declaration";
let number : int = 123123;

output

; ModuleID = 'samples/basic.rm'
source_filename = "samples/basic.rm"

@declaration = global [39 x i8] c"\22this is a global constant declaration\22"

define i32 @main() {
entry:
  %number = alloca i32, align 4
  store i32 123123, i32* %number, align 4
  ret i32 0
}

declare i8 @printf(i8 %0)

define i8 @my_fn(i8 %0) {
entry:
  %var_inside_function = alloca i32, align 4
  store i32 123, i32* %var_inside_function, align 4
}

About

a smol compiler I've been working on for the past few weeks

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published