https://github.com/jonathanwoollett-light/cranelift-lang
https://github.com/jonathanwoollett-light/cranelift-lang
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jonathanwoollett-light/cranelift-lang
- Owner: JonathanWoollett-Light
- Created: 2023-02-04T14:08:42.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-08-08T02:09:05.000Z (almost 2 years ago)
- Last Synced: 2025-01-30T19:19:07.116Z (5 months ago)
- Language: Rust
- Size: 405 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cranelift-lang
Goal: As much compile time analysis as possible.
### AST
The goal is to have a very simple language.
A visualization I use for illustrate the abstract syntax tree:

### Compile-time evaluation

becomes

### Parsing
```txt
x = ?
y = 2
y = x
a = 2
b = 3
c = add {a,b,}
d = ?
if 1
c = add {d,c,}
d = 4
a = d
loop
a = add {a,c,}
if 1
break
def triple_add
one = add {in[0],in[1],}
two = add {one,in[2],}
if 0
two = triple_add {two,two,two,}
out = two
a = triple_add {a,1,b,}
e = add {c,d,}
e = add {e,a,}
x = ?
e = add {x,e,}
if 1
out = e
out = 1
```becomes
