Documentation
¶
Index ¶
- Variables
- func BcBinop(op string, a, b any) any
- func BcConvert(target string, a any) any
- func BcSliceToAny(strs []string) []any
- func BcToBool(v any) bool
- func BcValuesEqual(a, b any) bool
- func InterpErr(reason string, node *ast.Node)
- func Interpret(ast *ast.Node, args []string, in io.Reader, out io.Writer, errOut io.Writer) (exitCode int)
- func IsDefun(node *ast.Node) bool
- func NumericBinop(op string, a, b any, node *ast.Node) any
- func RunBytecode(prog *bytecode.BCProgram, cliArgs []string, ...) (exitCode int)
- func RunBytecodeWithPolicy(prog *bytecode.BCProgram, cliArgs []string, policy ExecutionPolicy, ...) (exitCode int)
- func SliceToAny(strs []string) []any
- func ToBCFloat(v any) float64
- func ToBool(v any, node *ast.Node) bool
- func ToFloat(v any) (float64, bool)
- func ToInt(v any) (int64, error)
- func ValuesEqual(a, b any) bool
- type BCVM
- type BcEnv
- type ExecutionPolicy
- type InterpEnv
- type InterpFunc
- type Interpreter
- type VMError
- type VMLimits
- type VmExit
- type VmReturn
Constants ¶
This section is empty.
Variables ¶
var DefaultLimits = VMLimits{
MaxInstructions: 100000,
MaxMemoryBytes: 67108864,
MaxCallDepth: 128,
}
Functions ¶
func BcSliceToAny ¶
func BcValuesEqual ¶
func Interpret ¶
func Interpret(ast *ast.Node, args []string, in io.Reader, out io.Writer, errOut io.Writer) (exitCode int)
Interpret executes a cli_app AST directly and returns a process exit code. http_server/web_app roots are rejected with a clear error — Phase 1 is cli_app only, per docs/direct_execution_design.md.
func RunBytecode ¶
func RunBytecodeWithPolicy ¶
func RunBytecodeWithPolicy(prog *bytecode.BCProgram, cliArgs []string, policy ExecutionPolicy, allowedCaps []capability.Capability, in io.Reader, out io.Writer, errOut io.Writer) (exitCode int)
RunBytecodeWithPolicy executes bytecode under authority selected by the trusted runner. Capabilities remain an independent grant: increasing a resource limit does not authorize any external effect.
func SliceToAny ¶
func ValuesEqual ¶
Types ¶
type BCVM ¶
type BCVM struct {
Limits VMLimits
AllowedCaps []capability.Capability
In io.Reader
Out io.Writer
ErrOut io.Writer
// contains filtered or unexported fields
}
type ExecutionPolicy ¶
type ExecutionPolicy struct {
Limits VMLimits
}
ExecutionPolicy is authority supplied by the trusted bytecode runner. It may constrain an application, but application code cannot inspect or widen it. The zero value is fail-closed and permits no instruction execution.
func DefaultExecutionPolicy ¶
func DefaultExecutionPolicy() ExecutionPolicy
DefaultExecutionPolicy returns a copy of the standalone VM's safe defaults.
type InterpEnv ¶
type InterpEnv struct {
// contains filtered or unexported fields
}
func NewInterpEnv ¶
type InterpFunc ¶
type InterpFunc struct {
// contains filtered or unexported fields
}
type Interpreter ¶
type Interpreter struct {
In io.Reader
Out io.Writer
ErrOut io.Writer
// contains filtered or unexported fields
}
Interpreter holds the global function table for a single -run invocation. defun bodies have no closure over caller scope, matching the Go backend's model where defun compiles to an independent top-level function.