runtimelib

package
v0.0.0-...-f282515 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptimizeExpr

func OptimizeExpr(in string) (string, error)

OptimizeExpr takes a JSON-encoded Expr, performs simple constant folding (integer arithmetic and string concatenation for +), and returns the optimized JSON-encoded Expr or an error.

Types

type Expr

type Expr struct {
	Kind  string `json:"kind"`
	Int   int    `json:"int,omitempty"`
	Str   string `json:"str,omitempty"`
	Op    string `json:"op,omitempty"`
	Left  *Expr  `json:"left,omitempty"`
	Right *Expr  `json:"right,omitempty"`
}

Expr is a tiny JSON-friendly expression representation used by the optimizer. Supported shapes: {"kind":"int","int":123} {"kind":"string","str":"hello"} {"kind":"binary","op":"+","left":{...},"right":{...}}

Jump to

Keyboard shortcuts

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