Skip to content

fioriandrea/math-expression-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Math Expressions Parser

This is a simple recursive descent parser made in JavaScript. It can parse simple math expressions like:

2^(5 + sin(20 + exp(2*(1 + 5))))

It also supports the use of variables.

Usage examples

const vars = {};
const expr = parse("x^2 + y^2", vars); //returns a function;

for(let i = 0; i < 20; i++) {
  vars.x = i;
  vars.y = i + 1;
  console.log(expr());
}

About

Simple Recursive Descent Parser made in JS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published