https://github.com/scriptype/interpreter
Fun side project
https://github.com/scriptype/interpreter
Last synced: 12 months ago
JSON representation
Fun side project
- Host: GitHub
- URL: https://github.com/scriptype/interpreter
- Owner: scriptype
- Created: 2015-08-14T16:29:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-14T21:23:56.000Z (over 10 years ago)
- Last Synced: 2025-03-25T21:11:36.824Z (about 1 year ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Interpreter
Side project just for fun.
It's not an interpreter exactly: it'll also evaluate what it has parsed.
And it's only capable of taking numbers and math operators as input.
For further development see `package.json`
## Example usage
Can be used as a module in CommonJS environments. Or you can just download the minified source code in the /bin folder and load it from your page. In both ways you will have the variable `Interpreter` in global scope.
```js
var Interpreter = require("./interpreter")
var test = require("./interpreter/test/test")
new Interpreter("3 + 5 * 8 / 16").interpret()
// 5.5
new Interpreter().interpret("10 * -5 * 2 + 2 - -5")
// -93
test.randomPenetration(500)
test.basic("5 + 2 / -8324.21 + +22 * -128")
```