import GolangLean.AST

namespace GolangLean

/-! # Runtime values.

Go is statically typed, so a faithful runtime keeps a `GoType` alongside each
value. For the first cut we keep things untyped (a tagged union) and recover
type safety later by adding a static type-checker pass on the AST. The shape
mirrors octive-lean's `Value`. -/

mutual

  inductive Value where
    | nil
    | boolV   : Bool → Value
    | intV    : Int → Value
    | floatV  : Float → Value
    | stringV : String → Value
    | sliceV  : Array Value → Value
    | mapV    : Array (Value × Value) → Value          -- ordered list, equality via key
    | structV : Array (String × Value) → Value
    | ptrV    : Nat → Value                             -- index into heap
    | funcV   : Closure → Value
    | chanV   : Nat → Value                             -- index into channel table
    | tupleV  : Array Value → Value                     -- multi-return packs

  /-- A function closure: signature + body + captured environment. -/
  inductive Closure where
    | mk : FuncType → Array Stmt → List (String × Value) → Closure

end

end GolangLean
