https://github.com/stepfenshawn/toycompiler
A toy functional programming language, with a tiny VM. Just for fun!
https://github.com/stepfenshawn/toycompiler
Last synced: about 1 year ago
JSON representation
A toy functional programming language, with a tiny VM. Just for fun!
- Host: GitHub
- URL: https://github.com/stepfenshawn/toycompiler
- Owner: StepfenShawn
- License: mit
- Created: 2023-07-31T04:10:05.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-25T13:17:27.000Z (over 1 year ago)
- Last Synced: 2025-01-29T08:11:53.148Z (over 1 year ago)
- Language: Haskell
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bblang[wip]
no loops(`For`, `While`...), just use recursion.
Examples:
```rust
fn fib(x: i64)
when x <= 2 then 1
otherwise fib(x - 1) + fib(x - 2);
fib(40);
```
define a macro:
```rust
macro hello
when ($s: str) then "Hello" + $s
when ($n: ident) then $n
otherwise "";
print hello!("bblang");
let a: i64 = 1;
print hello!(a);
```
`map` as a macro:
```rust
let arr = map!([1, 2, 3] x * x);
print arr
```
# Build
* ghc
* cabal
```
cabal run bblang
```
# Test
```
cabal run test
```