1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 02:59:54 +00:00

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

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)
)