An open API service indexing awesome lists of open source software.

https://github.com/probablyclem/compiler


https://github.com/probablyclem/compiler

Last synced: 11 months ago
JSON representation

Awesome Lists containing this project

README

          

# ROO
## Rust Object Oriented
* Rust like syntax
* Static typing
* Made for OO
* Borrow checker

## Requirement
* Linux
* lcc (LLVM)
* gcc

## Installation
Clone the repos
build with `make`

## usage
```
$./roo input_file
```
input_file file being the file to compile.
Then run
```
$./run.sh
```
to compile the llvm file into an executable and launch it.
The output will be ./a.out

# Compiler Architecture
## Lexer
### scan.c
Convert the code into token.
Throw an error if the lexer don't recognize the input.

## Parser
### expr.c
Generate an AST from the tokens.
The tree is generated with the token's priority found in `OpPrec[]`.
Thrown an error if the input does't respect the grammar.
### tree.c
Utils for generating AST nodes.

### stmt.c
Functions trees from statements such as functions or loops.

### misc.c
Utils requesting token such as colon().

### types.c
Functions managing types compatibilities.

## LLVM generator
### gen.c

Generate llvm ir code from the AST.

### cg.c
Utils for generating llvm code.

## Other
### main.c
[Entry]
Open and close files and calls other files?

### data.h
Expose global variables.

### decl.h
Expose public functions.

### defs.h
Public Enums

### delc.c
Utils for declaring variables or functions.

### sym.c
Functions managing the symbols tables.

# Ressources
Compiler tutorial : https://github.com/DoctorWkt/acwj
LLVM IR doc : http://llvm.org/docs/LangRef.html
LLVM IR unofficial guide : https://mapping-high-level-constructs-to-llvm-ir.readthedocs.io/en/latest/README.html