0.17.2 • Published 4 years ago
Quick Start
const compiler = require('math-compiler')
// compiling
compiler.compile('basic-infix', 'basic-postfix', 'a + b^(c - d)')) // 'a b c d - ^ +'
// lexing
compiler.lex('basic-infix', 'a + b^(c - d)') // [ IdentifierToken { value: 'a' }, OperatorToken { value: '+' }, ... ]
// parsing
compiler.parse('basic-infix', 'a + b^(c - d)') // OperationNode { operator: '+', ... }
// transforming
compiler.transform('basic-infix', OperationNode) // Exomath-compliant OperationNode
// generating
compiler.generate('basic-infix', Node) // 'a + b ^ ( c - d )'
Formats
- Formats with the prefix "basic" have limited functionality and are for educational purposes only.
Future Formats
Installation
NPM
$ npm i @exomath/math-compiler
Yarn
$ yarn add @exomath/math-compiler