Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codenameyau/calc-lang
Calculator interpreter language
https://github.com/codenameyau/calc-lang
abstract-syntax-tree calculator compiler grammar interpreter language math programming
Last synced: 24 days ago
JSON representation
Calculator interpreter language
- Host: GitHub
- URL: https://github.com/codenameyau/calc-lang
- Owner: codenameyau
- License: mit
- Created: 2018-05-07T23:11:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-07-26T19:29:54.000Z (over 3 years ago)
- Last Synced: 2024-10-09T09:42:07.901Z (29 days ago)
- Topics: abstract-syntax-tree, calculator, compiler, grammar, interpreter, language, math, programming
- Language: JavaScript
- Size: 52.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# calc-lang
Calculator interpreter language.## Installation
```
npm install --save calc-lang
```### Tests
```
sudo npm install -g jest
jest
```## Examples
```js
const Interpreter = require('calc-lang');const interpreter = new Interpreter();
console.log(interpreter.run('jonny what is 13 * 37?'));
console.log(interpreter.run('((1 + (2 * 3)) * 4) / 2)');
```## Supported Operations
- Addition: +
- Subtraction: -
- Multiplication: * or x
- Division: /
- Parenthesis: ()### To Add
- Exponentiation: ^
- Modulo: %
- Trigonometry: sin, cos, tan
- Logical: true, false, !
- Logical Comparison: <, >, <=, >=, ==, !=