class Ven::Machine
- Ven::Machine
- Ven::Suite::Visitor
- Reference
- Object
Included Modules
Defined in:
ven/eval.crConstant Summary
-
B_FALSE =
MBool.new(false) -
B_TRUE =
MBool.new(true) -
Ven booleans are structs (copy on use). There is no need for the
.news everywhere (?) -
MAX_CALL_DEPTH =
512 -
Maximum call depth (see
#call).
Constructors
Instance Method Summary
-
#binary(operator, left : Model, right : Model)
Applies binary operator to left and right.
-
#call(callee : MBox, args : Models)
Instantiates an
MBoxwith arguments args. -
#call(callee : MConcreteFunction, args : Models, typecheck = true, generic = false) : Model
Calls an
MConcreteFunctionwith args, checking their types if typecheck is true. -
#call(callee : MGenericFunction, args) : Model
Calls an
MGenericFunctionwith args. -
#call(callee : MBuiltinFunction, args) : Model
Calls an
MBuiltinFunctionwith args. -
#call(vector : Vec, args)
Returns the n-th item of vector.
-
#call(string : Str, args)
Returns the n-th character of string.
- #call(callee : Model, args)
-
#compute(operator, left : Model, right : Model)
Computes a binary operation.
-
#constrained(names : Array(String), by types : Quotes)
Constrains names to types.
-
#die(message : String)
Dies of runtime error with message.
-
#fetch(name : String)
Calls
Context.fetchwith name and dies if not found. -
#field(head, accessor : SingleFieldAccessor)
Resolves a
SingleFieldAccessorfor head. -
#field(head, accessor : DynamicFieldAccessor)
Resolves a
DynamicFieldAccessorfor head. -
#field(head, accessor : MultiFieldAccessor)
Resolves a
MultiFieldAccessorfor head. -
#field(head, route : Array(FieldAccessor))
Resolves the route for head.
-
#field(head : Model, field : String) : Model | Nil
Accesses head's field field.
-
#normalize(operator, left : Model, right : Model) : Tuple(Model, Model)
Converts left and right into the types operator can work with.
-
#typecheck(constraints : ConstrainedParameters, args : Models) : Bool
Typechecks args against constraints (via
of?). -
#unary(operator, operand : Model) : Model
Applies unary operator to operand.
- #visit!(q : QSymbol)
- #visit!(q : QNumber)
- #visit!(q : QString)
- #visit!(q : QRegex)
- #visit!(q : QVector)
- #visit!(q : QUPop)
- #visit!(q : QURef)
- #visit!(q : QUnary)
- #visit!(q : QBinary)
- #visit!(q : QIntoBool)
- #visit!(q : QReturnDecrement)
- #visit!(q : QReturnIncrement)
- #visit!(q : QQuote)
- #visit!(q : QAccessField)
- #visit!(q : QBinarySpread)
- #visit!(q : QLambdaSpread)
- #visit!(q : QIf)
- #visit!(q : QBlock)
- #visit!(q : QAssign)
- #visit!(q : QBinaryAssign)
- #visit!(q : QFun)
- #visit!(q : QEnsure)
- #visit!(q : QCall)
- #visit!(q : QInfiniteLoop)
- #visit!(q : QBaseLoop)
- #visit!(q : QStepLoop)
- #visit!(q : QComplexLoop)
- #visit!(q : QModelCarrier)
- #visit!(q : QExpose)
- #visit!(q : QDistinct)
- #visit!(q : QNext)
- #visit!(q : QReturnStatement)
- #visit!(q : QReturnExpression)
- #visit!(q : QBox)
- #world : Ven::World
- #world=(world : World)
Instance methods inherited from class Ven::Suite::Visitor
last=(last : Quote)
last=,
visit(quote : Quote)visit(quotes : Quotes) visit, visit!(quote : _) visit!
Constructor Detail
Instance Method Detail
Applies binary operator to left and right.
Calls an MConcreteFunction with args, checking their
types if typecheck is true. generic determines the
behavior of 'next': if set to true, 'next' would not be
captured.
Calls an MGenericFunction with args.
Calls an MBuiltinFunction with args.
Computes a binary operation. Returns false if left and/or right are not of types operator can work with.
Constrains names to types. Evaluates the types,
making sure that each returns a type and dying if it
does not. Uses MType::ANY for the missing types, if
there are any.
Dies of runtime error with message. Constructs a
traceback where the top entry is the outermost call,
and the bottom entry the caller of death itself.
Issues a <unit> traceback entry to display the last
node in execution, unless it duplicates the last traceback
entry.
Resolves a SingleFieldAccessor for head. Simply an
unpack alias for #field(head, field);
Resolves a DynamicFieldAccessor for head. The field
of the DynamicFieldAccessor must evaluate to Str. Symbols
are interpreted differently: if a symbol is defined, its
value is used as a field's name; if it isn't it itself
is used as a field's name:
box Foo(a, b);
foo = Foo(3, 4);
#) 'a' is not defined at this point:
ensure foo.(a) is 3;
#) Now it is:
ensure { a = "b"; foo.(a) } is 4;
Resolves a MultiFieldAccessor for head. Returns a
Vec of the gathered values, or nil if some were not
found.
Accesses head's field field. Returns nil if there is no such field.
Converts left and right into the types operator can work with.
Typechecks args against constraints (via of?).