java.lang.Object
org.kink_lang.kink.Vm
A Kink vm, or 
 runtime.
- 
Field Summary
FieldsModifier and TypeFieldDescriptionfinal BinHelperThe helper for bin vals.final BindingHelperThe helper for binding vals.final BoolHelperThe helper for bool vals.final ComponentRegistryThe component registry.final ExceptionHelperThe helper for exception vals.final FunHelperThe helper of funs.final GraphFacadeThe facade for the Execution Graph DSL.final JavaHelperThe helper for java vals.final LocationHelperThe helper for location vals.final ValThe nada val.final NumHelperThe helper for num vals.final SharedVarsFactoryThe factory of SharedVars.final StrHelperThe helper for str vals.final SymRegistryThe registry of syms.final TraceHelperThe helper for trace vals.final VarrefHelperThe helper for varref vals.final VecHelperThe helper for vec vals. - 
Method Summary
Modifier and TypeMethodDescriptionfinal ValnewVal()Returns a new val.final ValnewVal(SharedVars sharedVars) Returns a new val with the shared vars.static VmnewVm()Returns a new vm.<T> Trun(HostFunAction bootstrapAction, Function<? super Val, ? extends T> onReturned, Function<? super ExceptionVal, ? extends T> onRaised) Runs a new execution stack which starts from the bootstrap action. 
- 
Field Details
- 
nada
The nada val. - 
bool
The helper for bool vals. - 
binding
The helper for binding vals. - 
num
The helper for num vals. - 
str
The helper for str vals. - 
bin
The helper for bin vals. - 
fun
The helper of funs. - 
varref
The helper for varref vals. - 
exception
The helper for exception vals. - 
vec
The helper for vec vals. - 
trace
The helper for trace vals. - 
location
The helper for location vals. - 
java
The helper for java vals. - 
sym
The registry of syms. - 
graph
The facade for the Execution Graph DSL. - 
component
The component registry. 
 - 
 - 
Method Details
- 
newVm
Returns a new vm.- Returns:
 - a new vm.
 
 - 
newVal
Returns a new val.- Returns:
 - a new val.
 
 - 
run
public <T> T run(HostFunAction bootstrapAction, Function<? super Val, ? extends T> onReturned, Function<? super ExceptionVal, ? extends 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
onReturnedwith the result val. If the execution fails, the method invokesonRaisedwith the exception.Example:
FunVal fun = ...; boolean isSuccess = vm.run( c -> c.call(fun).args(x, 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 ofonReturnedandonRaised.- Parameters:
 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.- Returns:
 - the result of 
onReturnedoronRaised. 
 
 -