Module Bidir.Interpret

Defines the concrete forwards and backwards interpretation of Types.bidir.

val lens_of_expr : Types.expr -> (Types.state -> Types.value) option * (Types.value -> Types.state -> Types.state)

Constructs an accessor and setter pair for the given expression (i.e., an explicit lens).

The getter may be None if the expression contains a Types.expr.EWildcard; wildcard expressions cannot be loaded.

Returned getters and setters may throw. For example, a getter might throw if a required variable is undefined. A setter might throw if its given value does not match the required tuple structure.

  • raises Stdlib.Failure

    in case of value mismatches while pattern matching (provided the types agree).

Executes the given bidirectional program with the given initial state and intrinsic implementation. The program will be executed in forwards or reverse order depending on the specified direction.

  • raises Stdlib.Failure

    in case of local failure within the DSL (e.g., pattern match failure).