DSH calculator tool plug-in
omdsh-dev/dsh-tool-calculator · tools
DSH calculator tool plugin: safe mathematical expression evaluator, zero-dependency recursive descent parser
★ 9GitHub stars
0Forks
2026-08-14Last updated
TypeScriptLanguage
MITLicense
Key features
- Use handwritten recursive descent parser (lexical level + syntax level), only evaluate whitelist nodes
- src/index.tsCordis plug-in entrance (name/inject/apply), register calculator tool
- The lexical layer only recognizes numeric literals, whitelist identifiers, and operators
- The identifier is checked by name in the whitelist (15 functions + 2 constants). If not found, Unknown identifier is thrown.
- The evaluation result must be a finite number, NaN/Infinity (division by zero, negative number square root, etc.) are uniformly rejected
Requirements
- Consumption verificationtarball is loaded into 0.1.0-rc.6 consumer → dsh --profile compat --dump-config This plug-in row appears → the actual registration and execution of the tool pass
Install command
dsh plugin --profile web add github:omdsh-dev/dsh-tool-calculator