Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koukyosyumei/mycompiler
Toy compiler from a simple language to LLVM-IR implemented from scratch in Haskell
https://github.com/koukyosyumei/mycompiler
compilier llvm llvm-ir
Last synced: 15 days ago
JSON representation
Toy compiler from a simple language to LLVM-IR implemented from scratch in Haskell
- Host: GitHub
- URL: https://github.com/koukyosyumei/mycompiler
- Owner: Koukyosyumei
- License: apache-2.0
- Created: 2024-02-24T23:26:53.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-07T12:20:45.000Z (7 months ago)
- Last Synced: 2024-10-09T10:44:34.427Z (about 1 month ago)
- Topics: compilier, llvm, llvm-ir
- Language: Haskell
- Homepage:
- Size: 10.9 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MyCompilier
This project implements a compiler that translates code from a simple language into LLVM IR. This project is inspiered by [Kaleidoscope](https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/index.html).
What it does:
- Takes source code as input and breaks it down into its building blocks (identifiers, numbers, expressions) using a lexer and parser.
- Generates LLVM IR that represents the functionality of the source code. This code can then be compiled and run by an LLVM toolchain.What it can do:
- Handles basic expressions involving arithmetic operations (addition, multiplication, comparison).
- Supports function definitions with arguments and function calls.
- Generates code for conditional statements (if statements)Examples
```
./main "def main() if 4<3 then 12 else 13;" | lli; echo $?
```