Skip to content

jsonicjs/expr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

158 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors