From cc8eeeb482f279c80ebef17fc5968e73a51b48b8 Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Thu, 6 Nov 2025 21:12:44 -0800 Subject: add examples --- examples/runtime.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 examples/runtime.ts (limited to 'examples/runtime.ts') 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] -- cgit v1.2.3-70-g09d2