0.0.4 • Published 5 years ago

kalimotxo v0.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Kalimotxo

Kalimotxo is a library to parse operator grammar.
Kalimotxo can add operators dynamically.

How to use

node.js

Install Kalimotxo:

npm install kalimotxo

Use module:

var R = require('kalimotxo');

Browser

<script src="kalimotxo.js"></script>

Examples

Arithmetic Operator

var rules = K.Operator(options);
rules.addInfixLToR("+", 700, (x, y) => x + y);
rules.addInfixLToR("-", 700, (x, y) => x - y);
rules.addInfixLToR("*", 800, (x, y) => x * y);
rules.addInfixLToR("/", 800, (x, y) => x / y);

console.log(rules.parse("1+2*3", 0).attribute);  // outputs 7