Runs math expression through parser and then evaluate the value.
for installing run
$ git clone https://github.com/itamar244/arithmetic-evaluator.git
$ npm install
some scripts are added for convenience
$ npm start
$ npm test
$ npm run build
get master
branch for better supports or get ast-parser
for faster and revisted parser ad evaluator.
the following operators are legal: +, -, *, /, %, ^.
numbers can be both integers, floating numbers and Infinity
.
the following functions are available:
constants can be used. they need to be in capital letters only.
they are the same as the constants in Math object.
parameters can be used too. just use lower-cased chars and for each char the program will ask for its value.
also supports equations. just put one parameter in the equation and add =
sign.
this statement will add file’S progmam to the top of the fileimport '<FILE_NAME>'
FILE_NAME
- relative path to the current filename
this statements creates a function reusable codefunc <NAME>(...PARAMS) <STATEMENT>
NAME
- the name of the functionPARAMS
- list of parameters seperated by commasSTATEMENT
- the statement to evaluate and return from the function