a very very tiny (641 byte) math evaluator in javascript
https://basilpa.ws/tinyexpr
| .gitignore | ||
| .prettierrc | ||
| LICENSE.md | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| tinyexpr.js | ||
| tinyexpr.test.ts | ||
| tinyexpr.ts | ||
| tsconfig.json | ||
tinyexpr
a very very tiny (642 byte bundled, 424 byte gzipped) math evaluator in javascript
it isn't fast, it could be smaller, it isn't written well, but it was fun to make :)
developing
source is in tinyexpr.ts, go nuts
building
there is a prebuilt file called tinyexpr.js in the repo, but if you're hacking this and want to rebuild it use pnpm build
how it could be smaller
if you wanna take a shot at it:
- roll tokenizing and evaluating into one step
- use something other than recursive descent parsing
- probably a lot of little hand optimizations