From a72ff678da253fce46e8e4648f6e4cf5ce1ea9b4 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 10 Mar 2024 21:39:53 -0500 Subject: uh new start --- repl.lua | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 repl.lua (limited to 'repl.lua') diff --git a/repl.lua b/repl.lua deleted file mode 100644 index a89fd2c..0000000 --- a/repl.lua +++ /dev/null @@ -1,42 +0,0 @@ ---- lam.repl - -local repl = {} -local eval = require "eval" -local read = require "read" -local util = require "util" -table.unpack = table.unpack or unpack - -function schemestr(x) - if type(x) == "table" then - local ts = "(" .. schemestr(util.pop(x)) - for i,v in ipairs(x) do - ts = string.format("%s %s", ts, schemestr(v)) - end - ts = ts .. ")" - return ts - elseif x == true then - return "#t" - elseif x == false then - return "#f" - else - return tostring(x) - end -end - -function repl.repl (prompt) - prompt = prompt or "lam> " - repeat - io.write(prompt) - io.output():flush() - input = io.read() - if input == ",q" or input == ",quit" then - break - else - val = eval(read(input)) - if val then print(schemestr(val)) end - end - until false -end - ---- -return repl -- cgit 1.4.1-21-gabe81