Documentation

Strata.DL.Imperative.StmtEval

Generic small-step evaluator #

RunConfig mirrors Config but is parameterized by a generic state type S instead of Env P, so that concrete interpreters (e.g. Core) can thread their own rich environment through the stepper.

inductive Imperative.RunConfig (P : PureExpr) (CmdT S : Type) :

Configuration for the generic stepper, parameterized by state S.

Instances For
    structure Imperative.RunOps (P : PureExpr) (CmdT S : Type) :

    Operations the stepper needs from the state.

    • evalExpr : S → P.Expr → Option P.Expr

      Evaluate a expression to a value.

    • evalCmd : S → CmdT → S

      Execute a command, producing a new state.

    • extendFactory : S → PureFunc P → S

      Extend the evaluator with a function declaration.

    • pushScope : S → S

      Push a new variable scope (for blocks).

    • popScope : S → S

      Pop a variable scope (for blocks).

    • addError : S → String → S

      Produce a new state with an error

    • hasError : S → Bool

      Check if the state has an error (to short-circuit execution).

    Instances For
      def Imperative.runStep {P : PureExpr} {CmdT S : Type} [BEq P.Expr] [HasBool P] (ops : RunOps P CmdT S) (c : RunConfig P CmdT S) :
      RunConfig P CmdT S
      Equations
      Instances For
        def Imperative.runStmt {P : PureExpr} {CmdT S : Type} [BEq P.Expr] [HasBool P] (ops : RunOps P CmdT S) (fuel : Nat) (c : RunConfig P CmdT S) :
        RunConfig P CmdT S
        Equations
        Instances For