flatstack

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package flatstack provides the runner embedding API with an opt-in flat bytecode backend. Unsupported programs are rejected before execution and run by the full interpreter, preserving runner behavior while the bytecode subset grows.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Supports

func Supports(p *model.Program) error

Supports reports whether p will execute through flat bytecode rather than the compatibility interpreter. Call this in benchmarks to prevent measuring an accidental fallback.

Example
package main

import (
	"fmt"

	"github.com/titpetric/phpscript/flatstack"
	"github.com/titpetric/phpscript/parser"
)

func main() {
	program, _ := parser.Parse(`<?php $a = "flat"; echo $a . "stack"; ?>`)
	fmt.Println(flatstack.Supports(program) == nil)
}
Output:
true

Types

type Context

type Context = runner.Context

func FromRequest

func FromRequest(r *http.Request) Context

func NewContext

func NewContext() Context

type ExitError

type ExitError = runner.ExitError

func IsExit

func IsExit(err error) (*ExitError, bool)

type ExprCache

type ExprCache = runner.ExprCache

func NewExprCache

func NewExprCache() *ExprCache

type HostPanicError

type HostPanicError = runner.HostPanicError

type IncludeCache

type IncludeCache = runner.IncludeCache

func NewIncludeCache

func NewIncludeCache() *IncludeCache

type IncludeFunc

type IncludeFunc = runner.IncludeFunc

type Options

type Options = runner.Options

type Runtime

type Runtime = runner.Runtime

func New

func New(w io.Writer, opts Options) *Runtime

type Scope

type Scope = runner.Scope

func NewScope

func NewScope() *Scope

func ScopeFromContext

func ScopeFromContext(ctx context.Context) (*Scope, bool)

type Transpiler

type Transpiler = runner.Transpiler

func NewTranspiler

func NewTranspiler() *Transpiler

Directories

Path Synopsis
Package engine compiles model AST programs into flat bytecode and executes them against a host-provided PHP semantics bridge.
Package engine compiles model AST programs into flat bytecode and executes them against a host-provided PHP semantics bridge.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL