summaryrefslogtreecommitdiff
path: root/examples/fib.int
diff options
context:
space:
mode:
authorTom Harley2019-12-23 01:32:39 +0000
committerTom Harley2019-12-23 01:32:39 +0000
commit7bc67b95161a34f8eca635d4000d9602508a9243 (patch)
tree585b3778dc1967832390e5829e4b3909b4184a2c /examples/fib.int
parentAdd basics for interpreter; add CLI options (diff)
downloadsinter-7bc67b95161a34f8eca635d4000d9602508a9243.tar.gz
sinter-7bc67b95161a34f8eca635d4000d9602508a9243.zip

checkpoint

Diffstat (limited to 'examples/fib.int')
-rw-r--r--examples/fib.int12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/fib.int b/examples/fib.int
new file mode 100644
index 0000000..11736d0
--- /dev/null
+++ b/examples/fib.int
@@ -0,0 +1,12 @@
+[dec wowow []]
+[type test [(INT x) (INT y)]]
+[def testest [] [test.y [test 3 10]]]
+[def dec [n] [- n 1]]
+[def inc [n] [+ n 1]]
+[def ttt [x y] [test y x]]
+[def ! [b] [if b 0 1]]
+[def != [x y] [- x y]]
+[def == [x y] [! [!= x y]]]
+[def or [a b] [if a 1 b]]
+[def fib [n] [debug_int [if [or [== n 0] [== n 1]] 1 [+ [fib [- n 1]] [fib [- n 2]]]]]]
+[def inter_main [] [fib [test.y [ttt 10 10]]]]