2024-12-18 19:15:56 -06:00
# sapling
2024-12-27 15:40:50 -06:00
## Introduction
2024-12-18 19:41:12 -06:00
sapling is a "micro-language" that I'm working on to investigate [Tree Calculus ](https://github.com/barry-jay-personal/typed_tree_calculus/blob/main/typed_program_analysis.pdf ) .
2024-12-18 19:15:56 -06:00
It offers a minimal amount of syntax sugar:
- `t` operator behaving by the rules of Tree Calculus
2024-12-27 15:40:50 -06:00
- Function ("variable") definitions
2024-12-18 19:15:56 -06:00
- Lambda abstractions
2024-12-27 15:40:50 -06:00
- List, Number, and String literals (WIP)
2024-12-18 19:15:56 -06:00
2024-12-18 19:41:12 -06:00
This is an active experimentation project by [someone who has no idea what they're doing ](https://eversole.co ).
2024-12-18 19:15:56 -06:00
2024-12-27 15:40:50 -06:00
## What does it look like?
```
false = t
true = t t
id = (\\a : a)
triage = (\\a b c : t (t a b) c)
match_bool = (\\ot of : triage of (\\z : ot) t)
and = match_bool id (\\z : false)
if = (\\cond then else : t (t else (t t then)) t cond)
triage = (\\a b c : t (t a b) c)
test = triage \"leaf\" (\\z : \"stem\") (\\a b : \"fork\")
sapling < test t
sapling > Fork (...)
DECODE -: "leaf"
sapling < test ( t t )
sapling > Fork (...)
DECODE -: "stem"
sapling < test ( t t t )
sapling > Fork (...)
DECODE -: "fork"
```
## How to use
For now, you can easily build and run this project using Nix:
1. Clone the repository:
a. `git clone ssh://git.eversole.co/sapling.git`
b. `git clone https://git.eversole/sapling.git`
1. Run the REPL: `nix run`
2024-12-18 19:15:56 -06:00
## Acknowledgements
Tree Calculus was discovered by [Barry Jay ](https://github.com/barry-jay-personal/blog ).
2024-12-18 19:41:12 -06:00
[treecalcul.us ](https://treecalcul.us ) is an excellent website with an intuitive playground created by [Johannes Bader ](https://johannes-bader.com/ ) that introduced me to Tree Calculus. If sapling sounds interesting but compiling this repo sounds like a hassle, you should check out his site.