git-subtree-dir: golang-lean git-subtree-mainline:6487c7046fgit-subtree-split:f5f1701922
25 lines
742 B
Text
25 lines
742 B
Text
import GolangLean.AST
|
|
import GolangLean.Env
|
|
import GolangLean.Error
|
|
|
|
namespace GolangLean
|
|
|
|
/-! # Evaluator — operational big-step interpreter over the AST.
|
|
|
|
Mirror of octive-lean's `Eval`. Monad stack `ExceptT GoError (StateT Env IO)`,
|
|
chosen for the same reason: state survives non-local control flow (defer,
|
|
panic, goroutine spawn) carried as exceptions. -/
|
|
|
|
abbrev EvalM := ExceptT GoError (StateT Env IO)
|
|
|
|
partial def evalExpr (_e : Expr) : EvalM Value :=
|
|
throw (.notImpl "Eval.evalExpr")
|
|
|
|
partial def evalStmt (_s : Stmt) : EvalM Unit :=
|
|
throw (.notImpl "Eval.evalStmt")
|
|
|
|
def runFile (path : String) : IO UInt32 := do
|
|
IO.eprintln s!"golang-lean: would execute {path} (interpreter not yet implemented)"
|
|
return 1
|
|
|
|
end GolangLean
|