@jsonic/expr
v2.3.2
Published
This plugin allows the [Jsonic](https://jsonic.senecajs.org) JSON parser to support expression syntax.
Maintainers
Readme
@jsonic/expr
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.
Install
TypeScript:
npm install @jsonic/expr jsonicGo:
go get github.com/jsonicjs/expr/goDocumentation
Docs 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.
License
MIT. See LICENSE.
