An expression-syntax plugin for the Jsonic parser, available in both TypeScript and Go.
Adds Pratt-parser expressions to Jsonic: infix, prefix, suffix, ternary, and paren operators with configurable precedence. Expressions parse into LISP-style S-expressions (arrays whose first element is the operator src), which a user-supplied evaluator can reduce to values.
TypeScript:
npm install @jsonic/expr jsonicGo:
go get github.com/jsonicjs/expr/goDocs are organised following the Diátaxis framework:
- Tutorial — start here. Parse your first expression in TS and Go.
- How-to guides — focused recipes: add an operator, plug in an evaluator, use paren-preval for function calls, restrict to strict math.
- Reference — exported types and functions,
OpDefschema, default operator set, grammar group tags. - Explanation — design notes: Pratt algorithm,
S-expression AST, paren/ternary/preval semantics, why
g=exprtagging.
MIT. See LICENSE.