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:
parent
88a24531de
commit
058780085b
22
libs/repl.gst
Normal file
22
libs/repl.gst
Normal 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)
|
||||
)
|
Loading…
Reference in New Issue
Block a user