https://github.com/jacobious52/test-lang-llvm
Test programming language for learning compilation to llvm ir
https://github.com/jacobious52/test-lang-llvm
Last synced: 10 months ago
JSON representation
Test programming language for learning compilation to llvm ir
- Host: GitHub
- URL: https://github.com/jacobious52/test-lang-llvm
- Owner: Jacobious52
- Created: 2016-12-03T07:13:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-03T07:28:48.000Z (over 9 years ago)
- Last Synced: 2025-03-11T16:33:54.365Z (about 1 year ago)
- Language: Go
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# test-lang-llvm
Test (functional) programming language for learning compilation to llvm ir.
Not a serious langauge. For the purposes of learning only
Built in Go programming langauge. Uses llvm Go bindings to generator llvm ir. Bindings must be in go path to compile compiler yourself
Makes use of trivial llvm optimisation like constant folding and tail recusion.
Only one type at this time, doubles
Currently compiler runs in JIT mode. Cntrl^D to insert EOF and compile function or run expression
Example: test.lang
```
def factIter: n, product {
if n = 0, product
else factIter(n-1, n*product)
}
def fact: n { factIter(n, 1) }
def fib: n {
if n < 2, n
else fib(n-1) + fib(n-2)
}
def rand: {4}
def inc: x { x + 1 }
```