Skip to content

Latest commit

 

History

History
38 lines (24 loc) · 844 Bytes

README.md

File metadata and controls

38 lines (24 loc) · 844 Bytes

math expression evaluator

Build a math expression evaluator

What it is comprised of

  1. Tokenizer
  2. Parser
  3. Evaluator

How it works

  1. The input is taken in as a string and the white-spaces are removed.
  2. A tokenizer is instantiated that creates tokens by iterating through each character of the input.
  3. An Abstract Syntax Tree is generated from the tokens.
  4. Evaluation is then performed, generating a single f64 value

Example Expression

(5*32-2^5)*0.125  #16.0

How to run

Make sure you have rust tool-chain installed, if not go here

cargo run

And then enter the expressions you want to evaluate.

Use ctrl+c to exit the program.

Screenshot

Screenshot of the Program