Automatic decoding of supported literals in REPL

Automatic decoding & display of string, number, and list types in REPL.
General updates to README, style, and comments.
This commit is contained in:
2024-12-27 15:40:50 -06:00
committed by James Eversole
parent 9c1c916fc9
commit 1224961c62
6 changed files with 86 additions and 23 deletions

View File

@ -1,16 +1,51 @@
# sapling
## Introduction
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) .
It offers a minimal amount of syntax sugar:
- `t` operator behaving by the rules of Tree Calculus
- Variable definitions
- Function ("variable") definitions
- Lambda abstractions
- List, Integer, and String literals
- List, Number, and String literals (WIP)
This is an active experimentation project by [someone who has no idea what they're doing](https://eversole.co).
## 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`
## Acknowledgements
Tree Calculus was discovered by [Barry Jay](https://github.com/barry-jay-personal/blog).