Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 1.42 KB

File metadata and controls

44 lines (31 loc) · 1.42 KB

@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.

npm version build

Install

TypeScript:

npm install @jsonic/expr jsonic

Go:

go get github.com/jsonicjs/expr/go

Documentation

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, OpDef schema, default operator set, grammar group tags.
  • Explanation — design notes: Pratt algorithm, S-expression AST, paren/ternary/preval semantics, why g=expr tagging.

License

MIT. See LICENSE.