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 : SP.ExprOption P.Expr

      Evaluate a expression to a value.

    • evalCmd : SCmdTS

      Execute a command, producing a new state.

    • extendEval : SPureFunc PS

      Extend the evaluator with a function declaration.

    • pushScope : SS

      Push a new variable scope (for blocks).

    • popScope : SS

      Pop a variable scope (for blocks).

    • addError : SStringS

      Produce a new state with an error

    • hasError : SBool

      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