1- # sub✦ script [ ![ build] ( https://github.com/dy/subscript/actions/workflows/node.js.yml/badge.svg )] ( https://github.com/dy/subscript/actions/workflows/node.js.yml ) [ ![ npm] ( https://img.shields.io/npm/v/subscript )] ( http://npmjs.org/subscript ) [ ![ ॐ] ( https://img.shields.io/badge/MIT-%E0%A5%90-white )] ( https://krishnized.github.io/license )
1+ # sub< sub >< sup > ✦ </ sup ></ sub > script [ ![ build] ( https://github.com/dy/subscript/actions/workflows/node.js.yml/badge.svg )] ( https://github.com/dy/subscript/actions/workflows/node.js.yml ) [ ![ npm] ( https://img.shields.io/npm/v/subscript )] ( http://npmjs.org/subscript ) [ ![ demo ] ( https://img.shields.io/badge/demo-%F0%9F%9A%80-white )] ( https://dy.github.io/subscript/repl ) [ ![ ॐ] ( https://img.shields.io/badge/MIT-%E0%A5%90-white )] ( https://krishnized.github.io/license )
22
33> Safe expression evaluator & language tool.
44
@@ -15,8 +15,6 @@ subscript`a + b * 2`({ a: 1, b: 3 }) // 7
1515* ** Self-hosting** — compiles own source (js in js)
1616* ** Language tool** — modular syntax extensions for custom DSL
1717
18- [ ** Try REPL →** ] ( https://dy.github.io/subscript/repl.html )
19-
2018
2119## Presets
2220
@@ -72,7 +70,7 @@ token('px', 200, n => n && [, n[1] + 'px']) // 5px → "5px"
7270See [ docs.md] ( ./docs.md ) for full API.
7371
7472
75- ## Expressions
73+ ## Expressions format
7674
7775Subscript uses simplified syntax tree format:
7876
@@ -106,7 +104,6 @@ subscript`constructor.constructor("alert(1)")()`({})
106104// undefined (blocked)
107105```
108106
109-
110107## Performance
111108
112109Parse 30k times:
@@ -115,32 +112,39 @@ subscript: ~150 ms 🥇
115112justin: ~183 ms
116113jsep: ~270 ms 🥈
117114jexpr: ~297 ms 🥉
118- ```
119- <!--
120115mr-parser: ~420 ms
121116expr-eval: ~480 ms
122117math-parser: ~570 ms
123118math-expression-evaluator: ~900ms
124119jexl: ~1056 ms
125120mathjs: ~1200 ms
126121new Function: ~1154 ms
127- -->
128122
129- Evaluate 30k times:
130- ```
123+ // Evaluate 30k times:
131124new Function ~7ms 🥇
132125subscript ~15ms 🥈
133126justin: ~17 ms
134127jsep ~30ms 🥉
135- ```
136- <!--
137128math-expression-evaluator: ~50ms
138129expr-eval: ~72 ms
139130jexl: ~110 ms
140131mathjs: ~119 ms
141- mr-parser: -
142- math-parser: -
143- -->
132+ ```
133+
134+
135+ ## Utils
136+
137+ ** Bundle** — create custom dialect bundle:
138+ ``` js
139+ import { bundle } from ' subscript/util/bundle.js'
140+
141+ // Bundle specific features into single file
142+ const code = await bundle (' subscript/jessie.js' )
143+ // → self-contained ES module with parse, compile exports
144+ ```
145+
146+ ** REPL** — interactive dialect builder with live bundling:
147+ [ ** Try REPL →** ] ( https://dy.github.io/subscript/repl.html )
144148
145149
146150## Used by
0 commit comments