Documentation ¶
Index ¶
- Constants
- Variables
- func MatchKApply(ref KReference, expectedLabel uint64, expectedArity uint64) bool
- func MatchKToken(ref KReference, expectedSort uint64) bool
- func MatchNonEmptyKSequence(ref KReference) bool
- func MatchNonEmptyKSequenceMinLength(ref KReference, minimumLength uint64) bool
- func StartTraceReferenceComparer(referenceFileName string)
- type Interpreter
- func (i *Interpreter) DebugPrint(info string, c m.KReference)
- func (i *Interpreter) Eval(c m.KReference, config m.KReference) (m.KReference, error)
- func (i *Interpreter) Execute(kastMap map[string][]byte) error
- func (i *Interpreter) ExecuteSimple(kdir string, execFile string)
- func (i *Interpreter) GetNrSteps() int
- func (i *Interpreter) GetState() m.KReference
- func (i *Interpreter) SetTracePretty()
- func (i *Interpreter) TakeStepsNoThread(k m.KReference) error
- type KReference
Constants ¶
const TopCellInitializer m.KLabel = m.LblInitGeneratedTopCell
TopCellInitializer ... label passed to Eval to initialize the top cell
Variables ¶
var NullReference = KReference(0)
NullReference is the zero-value of KReference. It doesn't point to anything. It has type nullRef.
Functions ¶
func MatchKApply ¶ added in v0.0.9
func MatchKApply(ref KReference, expectedLabel uint64, expectedArity uint64) bool
MatchKApply returns true if reference is a KApply with correct label and arity. Function should be inlined, for performance reasons.
func MatchKToken ¶ added in v0.0.9
func MatchKToken(ref KReference, expectedSort uint64) bool
MatchKToken returns true if reference is a KToken with correct sort. Function should be inlined, for performance reasons.
func MatchNonEmptyKSequence ¶ added in v0.0.9
func MatchNonEmptyKSequence(ref KReference) bool
MatchNonEmptyKSequence returns true if reference is a K sequence with at least this many items, OR another any item type other than empty K sequence. Function should be inlined, for performance reasons.
func MatchNonEmptyKSequenceMinLength ¶ added in v0.0.9
func MatchNonEmptyKSequenceMinLength(ref KReference, minimumLength uint64) bool
MatchNonEmptyKSequenceMinLength returns true if reference is a K sequence with at least this many items. Argument minimumLength must be minimum 2. Function should be inlined, for performance reasons.
func StartTraceReferenceComparer ¶
func StartTraceReferenceComparer(referenceFileName string)
StartTraceReferenceComparer ... set the code to compare each step to list of steps exported from somewhere else
Types ¶
type Interpreter ¶
type Interpreter struct { Model *m.ModelState MaxSteps int Verbose bool // contains filtered or unexported fields }
Interpreter is a container with a reference to model and basic options
func NewInterpreter ¶
func NewInterpreter(kryptoRef *krypto.Krypto) *Interpreter
NewInterpreter creates a new interpreter instance
func (*Interpreter) DebugPrint ¶
func (i *Interpreter) DebugPrint(info string, c m.KReference)
DebugPrint ... prints a K item to console, useful for debugging
func (*Interpreter) Eval ¶
func (i *Interpreter) Eval(c m.KReference, config m.KReference) (m.KReference, error)
Eval ... evaluates a KApply item based on its label and arguments
func (*Interpreter) Execute ¶
func (i *Interpreter) Execute(kastMap map[string][]byte) error
Execute interprets the program with the structure
func (*Interpreter) ExecuteSimple ¶
func (i *Interpreter) ExecuteSimple(kdir string, execFile string)
ExecuteSimple interprets the program in the file given at input
func (*Interpreter) GetNrSteps ¶
func (i *Interpreter) GetNrSteps() int
GetNrSteps yields how many steps were executed until now from the start of the last execution
func (*Interpreter) GetState ¶
func (i *Interpreter) GetState() m.KReference
GetLastState yields the current (last) state of the interpreter
func (*Interpreter) SetTracePretty ¶
func (i *Interpreter) SetTracePretty()
SetTracePretty makes the interpreter save pretty traces of the execution
func (*Interpreter) TakeStepsNoThread ¶
func (i *Interpreter) TakeStepsNoThread(k m.KReference) error
TakeStepsNoThread executes as many steps as possible given the starting configuration
type KReference ¶ added in v0.0.9
type KReference = uint64
KReference is a reference to a K item. For some types, like bool and small int, the entire state can be kept in the reference object. For the others, the reference contains enough data to find the object in the model state.
Source Files ¶
- constants.go
- error.go
- eval.go
- fresh.go
- functions.go
- global.go
- hooks_array.go
- hooks_bool.go
- hooks_buffer.go
- hooks_bytes.go
- hooks_float.go
- hooks_int.go
- hooks_io.go
- hooks_kequal.go
- hooks_kreflection.go
- hooks_list.go
- hooks_map.go
- hooks_mint.go
- hooks_set.go
- hooks_string.go
- interpreterDef.go
- interpreterFunc.go
- kmodelconvert.go
- kref.go
- krefInline.go
- run.go
- step.go
- stepLookups.go
- stepRules.go
- stuck.go
- testutil.go
- trace.go
- tracecompare.go
- tracekprint.go
- tracepretty.go