Begin implementing a repl in gst

This commit is contained in:
Calvin Rose 2017-05-07 21:36:04 -04:00
parent 88a24531de
commit 058780085b
1 changed files with 22 additions and 0 deletions

22
libs/repl.gst Normal file
View File

@ -0,0 +1,22 @@
(namespace-set! "gst.repl")
"Hold all compile time evaluators"
(export! "evaluators" {})
"Read a line"
(export! "readline" (fn []
(: b (buffer))
(read stdin 1 b)
(while (not (= (get "\n" 0) (get b (- (length b) 1))))
(read stdin 1 b)
)
(string b)
))
"Create a parser"
(export! "p" (parser))
(while 1
(: line (readline))
(print "Read line: " line)
)