Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 486 Bytes

README.md

File metadata and controls

14 lines (10 loc) · 486 Bytes

Simple Calculator

It's a JavaScript-based but using language design principles like tokenizing and parsing. We chose recursive descent parser becuase of it simplicity and it affords us the opportunity to calculae on-fly.

Only two functions are exposed via CALC object-- Tokenizer and Parser.

var test2 = "12 + 90 + (23 -9) + sin(0.3) + pi";

var tk2 = new CALC.Tokenizer(test2);

var parse2 = new CALC.Parser(tk2.tokens, tk2.inbuiltfn);

parse2.calc();