Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OptimizeExpr ¶
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":{...}}
Click to show internal directories.
Click to hide internal directories.