Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/japrozs/rim_llvm
a smol compiler I've been working on for the past few weeks
https://github.com/japrozs/rim_llvm
c compiler interpreters llir llvm
Last synced: 26 days ago
JSON representation
a smol compiler I've been working on for the past few weeks
- Host: GitHub
- URL: https://github.com/japrozs/rim_llvm
- Owner: japrozs
- License: mit
- Created: 2022-07-16T15:50:15.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-18T18:03:54.000Z (over 2 years ago)
- Last Synced: 2023-03-06T12:57:32.151Z (over 1 year ago)
- Topics: c, compiler, interpreters, llir, llvm
- Language: C
- Homepage:
- Size: 22.5 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 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
```bash
# 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](samples/basic.rm)
```rust
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`
```llvm
; 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
}
```