git-subtree-dir: golang-lean git-subtree-mainline:6487c7046fgit-subtree-split:f5f1701922
24 lines
720 B
Text
24 lines
720 B
Text
import GolangLean.Eval
|
|
|
|
namespace GolangLean
|
|
|
|
/-! # REPL — placeholder.
|
|
|
|
Go has no official REPL, but `gore` and `yaegi` show it is feasible: each
|
|
input is wrapped into a fresh `func main()` body or evaluated as a statement
|
|
sequence inside a persistent package-scope. We follow the latter approach. -/
|
|
|
|
partial def runREPL : IO Unit := do
|
|
IO.println "golang-lean v0.1 — interpreter scaffold (REPL not yet implemented)"
|
|
IO.println "Type Ctrl-D to exit."
|
|
let stdin ← IO.getStdin
|
|
let rec loop : IO Unit := do
|
|
IO.print "go> "
|
|
(← IO.getStdout).flush
|
|
let line ← stdin.getLine
|
|
if line.isEmpty then return ()
|
|
IO.println s!" parsed: {line.trimAscii} (stub)"
|
|
loop
|
|
loop
|
|
|
|
end GolangLean
|