eyg/interpreter/block

Values

pub fn call(
  f: value.Value(
    a,
    #(List(#(state.Kontinue(a), a)), state.Env(a)),
  ),
  args: List(
    #(
      value.Value(
        a,
        #(List(#(state.Kontinue(a), a)), state.Env(a)),
      ),
      a,
    ),
  ),
  env: state.Env(a),
) -> Result(
  #(
    option.Option(
      value.Value(
        a,
        #(List(#(state.Kontinue(a), a)), state.Env(a)),
      ),
    ),
    List(
      #(
        String,
        value.Value(
          a,
          #(List(#(state.Kontinue(a), a)), state.Env(a)),
        ),
      ),
    ),
  ),
  #(
    break.Reason(
      a,
      #(List(#(state.Kontinue(a), a)), state.Env(a)),
    ),
    a,
    state.Env(a),
    state.Stack(a),
  ),
)

Call an evaluated function with arguments

pub fn execute(
  exp: #(tree.Expression(t), t),
  scope: List(
    #(
      String,
      value.Value(
        t,
        #(List(#(state.Kontinue(t), t)), state.Env(t)),
      ),
    ),
  ),
) -> Result(
  #(
    option.Option(
      value.Value(
        t,
        #(List(#(state.Kontinue(t), t)), state.Env(t)),
      ),
    ),
    List(
      #(
        String,
        value.Value(
          t,
          #(List(#(state.Kontinue(t), t)), state.Env(t)),
        ),
      ),
    ),
  ),
  #(
    break.Reason(
      t,
      #(List(#(state.Kontinue(t), t)), state.Env(t)),
    ),
    t,
    state.Env(t),
    state.Stack(t),
  ),
)

Exectute a block of code. If there is no final expression no value is returned.

In all cases a scope is returned this can be used for builting REPL’s

pub fn resume(
  value: value.Value(
    t,
    #(List(#(state.Kontinue(t), t)), state.Env(t)),
  ),
  env: state.Env(t),
  k: state.Stack(t),
) -> Result(
  #(
    option.Option(
      value.Value(
        t,
        #(List(#(state.Kontinue(t), t)), state.Env(t)),
      ),
    ),
    List(
      #(
        String,
        value.Value(
          t,
          #(List(#(state.Kontinue(t), t)), state.Env(t)),
        ),
      ),
    ),
  ),
  #(
    break.Reason(
      t,
      #(List(#(state.Kontinue(t), t)), state.Env(t)),
    ),
    t,
    state.Env(t),
    state.Stack(t),
  ),
)

Resume the interpretation loop with a value from a previous break position. This can be used to resume after any break but is normally used to implement effects and reference lookup

Search Document