crosslang/golang-lean/GolangLean/REPL.lean
Maximus Gorog fd3d42ae33 Add 'golang-lean/' from commit 'f5f17019224c6a6c319387214ceb8e29d09251c6'
git-subtree-dir: golang-lean
git-subtree-mainline: 6487c7046f
git-subtree-split: f5f1701922
2026-05-12 02:59:14 -06:00

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