https://github.com/probablyclem/compiler
https://github.com/probablyclem/compiler
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/probablyclem/compiler
- Owner: ProbablyClem
- Created: 2020-07-19T19:52:27.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-05T19:27:01.000Z (almost 6 years ago)
- Last Synced: 2025-05-01T21:22:39.353Z (about 1 year ago)
- Language: C
- Size: 239 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
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