diff options
| author | Tom Harley | 2019-12-23 01:32:39 +0000 |
|---|---|---|
| committer | Tom Harley | 2019-12-23 01:32:39 +0000 |
| commit | 7bc67b95161a34f8eca635d4000d9602508a9243 (patch) | |
| tree | 585b3778dc1967832390e5829e4b3909b4184a2c /examples/tree.sin | |
| parent | Add basics for interpreter; add CLI options (diff) | |
| download | sinter-7bc67b95161a34f8eca635d4000d9602508a9243.tar.gz sinter-7bc67b95161a34f8eca635d4000d9602508a9243.zip | |
checkpoint
Diffstat (limited to 'examples/tree.sin')
| -rw-r--r-- | examples/tree.sin | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/tree.sin b/examples/tree.sin new file mode 100644 index 0000000..b11cae9 --- /dev/null +++ b/examples/tree.sin @@ -0,0 +1,16 @@ +[type branch_ [kind val l r]] +[type leaf_ [kind val]] + +[dec == [a b]] + +[def branch [v l r] + [branch_ 0 v l r]] + +[def leaf [x] + [leaf_ 1 x]] + +[def is_branch [x] + [== [branch_.kind x] 0]] + +[def is_leaf [x] + [== [leaf_.kind x] 1]] |
