Documentation
¶
Overview ¶
Package evaluator contains the core of our interpreter, which walks the AST produced by the parser and evaluates user code.
Index ¶
- func All(ctx context.Context, args ...object.Object) object.Object
- func Any(ctx context.Context, args ...object.Object) object.Object
- func Assert(ctx context.Context, args ...object.Object) object.Object
- func Bool(ctx context.Context, args ...object.Object) object.Object
- func Call(ctx context.Context, args ...object.Object) object.Object
- func Chr(ctx context.Context, args ...object.Object) object.Object
- func Delete(ctx context.Context, args ...object.Object) object.Object
- func Err(ctx context.Context, args ...object.Object) object.Object
- func Error(ctx context.Context, args ...object.Object) object.Object
- func Exit(ctx context.Context, args ...object.Object) object.Object
- func Fetch(ctx context.Context, args ...object.Object) object.Object
- func Float(ctx context.Context, args ...object.Object) object.Object
- func GetAttr(ctx context.Context, args ...object.Object) object.Object
- func GlobalBuiltins() []*object.Builtin
- func Int(ctx context.Context, args ...object.Object) object.Object
- func Iter(ctx context.Context, args ...object.Object) object.Object
- func Keys(ctx context.Context, args ...object.Object) object.Object
- func Len(ctx context.Context, args ...object.Object) object.Object
- func List(ctx context.Context, args ...object.Object) object.Object
- func Ok(ctx context.Context, args ...object.Object) object.Object
- func Ord(ctx context.Context, args ...object.Object) object.Object
- func Print(ctx context.Context, args ...object.Object) object.Object
- func Printf(ctx context.Context, args ...object.Object) object.Object
- func Reversed(ctx context.Context, args ...object.Object) object.Object
- func Set(ctx context.Context, args ...object.Object) object.Object
- func Sorted(ctx context.Context, args ...object.Object) object.Object
- func Sprintf(ctx context.Context, args ...object.Object) object.Object
- func String(ctx context.Context, args ...object.Object) object.Object
- func Try(ctx context.Context, args ...object.Object) object.Object
- func Type(ctx context.Context, args ...object.Object) object.Object
- func Unwrap(ctx context.Context, args ...object.Object) object.Object
- func UnwrapOr(ctx context.Context, args ...object.Object) object.Object
- type Breakpoint
- type Evaluator
- type Importer
- type Opts
- type SimpleImporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GlobalBuiltins ¶ added in v0.0.6
Types ¶
type Breakpoint ¶ added in v0.0.13
type Breakpoint struct {
// File is the file name of the breakpoint
File string
// Line is the line number of the breakpoint
Line int
// Disabled is true if the breakpoint is disabled.
Disabled bool
// Trace is true if the breakpoint should print a trace of the stack when
// it is hit.
Trace bool
// Stop is true if the breakpoint should stop code execution when it is hit.
Stop bool
}
func ParseBreakpoints ¶ added in v0.0.13
func ParseBreakpoints(desc string) ([]Breakpoint, error)
ParseBreakpoints parses a comma-separated list of breakpoints, where each breakpoint is formatted as "file:line:flags". The flags are optional and can be any combination of "n" (no-stop), "t" (trace), and "d" (disabled).
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator is used to execute Tamarin AST nodes.
func (*Evaluator) Evaluate ¶
Evaluate an AST node. The context can be used to cancel a running evaluation. If evaluation encounters an error, a Tamarin error object is returned.
func (*Evaluator) GetBreakpoint ¶ added in v0.0.13
func (e *Evaluator) GetBreakpoint(tok token.Token) (*Breakpoint, bool)
type Opts ¶
type Opts struct {
// Importer is used to import Tamarin code modules. If nil, module imports
// are not supported and an import will result in an error that stops code
// execution.
Importer Importer
// If set to true, the default builtins will not be registered.
DisableDefaultBuiltins bool
// Supplies extra and/or override builtins for evaluation.
Builtins []*object.Builtin
// Breakpoints for debugging
Breakpoints []Breakpoint
}
Opts configures Tamarin code evaluation.
Click to show internal directories.
Click to hide internal directories.