summaryrefslogtreecommitdiff
path: root/examples/runtime.ts
diff options
context:
space:
mode:
Diffstat (limited to 'examples/runtime.ts')
-rw-r--r--examples/runtime.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/runtime.ts b/examples/runtime.ts
new file mode 100644
index 0000000..2a1555c
--- /dev/null
+++ b/examples/runtime.ts
@@ -0,0 +1,15 @@
+/*
+KaiScript isn't just a pretty face (IDE hint), it's also a full and complete interpreted language.
+Any program you write in KaiScript will return exactly what it says it will.
+*/
+
+import { evaluate, lex, parse } from "../src";
+
+// First, hover over myArray in your IDE...
+// const myArray: [[1, 2, 3, 4, 5]]
+const myArray = evaluate(parse(lex(`arr(1,2,3,4,5)`)));
+
+// ...then run this file to see that the output matches
+console.log(myArray);
+
+// It's a nested tuple because all KaiScript programs are arrays. That is, the program <5, 3> would return [5, 3]