about summary refs log tree commit diff stats
path: root/repl.lua
diff options
context:
space:
mode:
authorCase Duckworth2024-03-19 22:13:44 -0500
committerCase Duckworth2024-03-19 22:13:44 -0500
commit9c5643d5f78e4228d47e293b421d7f388d47945f (patch)
tree3925d137d7820622b38f183ad259475ff48b39e5 /repl.lua
parentAdd QUOTE, QUASIQUOTE, UNQUOTE reading and generalize (diff)
downloadlam-9c5643d5f78e4228d47e293b421d7f388d47945f.tar.gz
lam-9c5643d5f78e4228d47e293b421d7f388d47945f.zip
A new start!
Diffstat (limited to 'repl.lua')
-rw-r--r--repl.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/repl.lua b/repl.lua new file mode 100644 index 0000000..34e4c94 --- /dev/null +++ b/repl.lua
@@ -0,0 +1,21 @@
1--- lam.repl
2
3local repl = {}
4local eval = require("eval").eval
5local read = require("read").read
6
7function repl.repl (prompt)
8 if not prompt then prompt = "lam> " end
9 io.input():setvbuf("line")
10 repeat
11 io.write(prompt)
12 io.output():flush()
13 local input = io.read()
14 if input == nil then break end
15 local value = eval(read(input))
16 if value then print(value) end
17 until false
18end
19
20---
21return repl