Class Vm


public class Vm extends Object
A Kink vm.
  • Field Details

    • nada

      public final Val nada
      The nada val.
    • bool

      public final BoolHelper bool
      The helper for bool vals.
    • binding

      public final BindingHelper binding
      The helper for env vals.
    • num

      public final NumHelper num
      The helper for num vals.
    • str

      public final StrHelper str
      The helper for str vals.
    • bin

      public final BinHelper bin
      The helper for bin vals.
    • fun

      public final FunHelper fun
      The helper of funs.
    • varref

      public final VarrefHelper varref
      The helper for varref vals.
    • exception

      public final ExceptionHelper exception
      The helper for exception vals.
    • vec

      public final VecHelper vec
      The helper for vec vals.
    • trace

      public final TraceHelper trace
      The helper for trace vals.
    • location

      public final LocationHelper location
      The helper for location vals.
    • java

      public final JavaHelper java
      The helper for java vals.
    • sym

      public final SymRegistry sym
      The registry of syms.
    • graph

      public final GraphFacade graph
      The facade for the Execution Graph DSL.
    • sharedVars

      public final SharedVarsFactory sharedVars
      The factory of SharedVars.
    • component

      public final ComponentRegistry component
      The component registry.
  • Method Details

    • newVm

      public static Vm newVm()
      Returns a new vm.
      a new vm.
    • newVal

      public final Val newVal()
      Returns a new val.
      a new val.
    • newVal

      public final Val newVal(SharedVars sharedVars)
      Returns a new val with the shared vars.
      sharedVars - shared vars as the initial variable mapping.
      a new val.
    • run

      public <T> T run(ThrowingFunction1<? super HostContext,HostResult> bootstrapAction, Function<Val,T> onReturned, Function<ExceptionVal,T> onRaised)
      Runs a new execution stack which starts from the bootstrap action.

      The execution starts from bootstrapAction.

      If the execution succeeds with a result, the method invokes onReturned with the result val. If the execution fails, the method invokes onRaised with the exception.


       FunVal fun = ...;
       boolean isSuccess =
            c ->, y),
            result -> { System.out.printf("OK!: %s%n", result); return true; },
            exc -> { System.out.printf("Bad: %s", exc); return false; }
      Type Parameters:
      T - the result type of onReturned and onRaised.
      bootstrapAction - the action which is called to start the execution.
      onReturned - called when the execution succeeds with a result.
      onRaised - called when the execution fails with an exception.
      the result of onReturned or onRaised.