blob: 34e4c94405f68ef67cf11dc5bef91a7a19520a5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
--- lam.repl
local repl = {}
local eval = require("eval").eval
local read = require("read").read
function repl.repl (prompt)
if not prompt then prompt = "lam> " end
io.input():setvbuf("line")
repeat
io.write(prompt)
io.output():flush()
local input = io.read()
if input == nil then break end
local value = eval(read(input))
if value then print(value) end
until false
end
---
return repl
|