Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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: <, >, <=, >=, ==, !=