Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hydrogen602/compiler
Trying to make a language and compiler
https://github.com/hydrogen602/compiler
Last synced: about 2 months ago
JSON representation
Trying to make a language and compiler
- Host: GitHub
- URL: https://github.com/hydrogen602/compiler
- Owner: hydrogen602
- License: mit
- Created: 2021-04-10T21:18:17.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-19T22:11:22.000Z (over 2 years ago)
- Last Synced: 2023-02-26T08:08:11.494Z (almost 2 years ago)
- Language: Haskell
- Size: 326 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Compiler
This project attempts to create a custom language and a compiler for it that generates LLVM IR.
~~A few examples of the language can be found in `fib.idk`, `fibR.idk`, `test.idk`, and `test.old.idk`.~~
This project used to be focused on generating MIPS code, but now I've transitioned to trying to use LLVM to simplify things.
Currently the language features functions, recursion, if, else, and while statements. The only type currently supported is integers.
See `comparison/README.md` for speed comparisons. Currently it looks to be 35% slower than C.
## How to run
Run `make build` to compile the compiler.
Run
```bash
cabal run compiler -- -i fibR.idk
```
to compile the `fibR.idk`. Then execute `./a.out` to run the compiled code.## ToDo List
- [ ] Enums on the heap
- [ ] Reference counting incrementing
- [ ] Emit llvm instructions for incr/decr reference counts - function calls are slow
- [ ] Make performance tests for benchmarking against C and past/future versions