Code

This section just shows some snippets of the code I wrote, if you want to see the full project (or more), it’s open-source on github. All of this code is written in TypeScript, with the help of a few libraries.

There are 4 main modules we need to write for this:

  1. Parser. It takes the input you type and transforms it into a tree
  2. Orderer. Re-arranges the tree to follow the order of operations
  3. Evaluator. Takes a tree as input and evaluates/solves it as much as it can.
  4. Simplifier. Evaluates the expression even further (more on this later)

Go To:

< Operator Precedence Parser >