A simple calculator built with ReactJS (demo)
- Multiple operand expressions (eg:
3 + 5 * 6 - 2
), follow BODMAS rule - Support decimal number (eg:
3.5 * 2
)
Using Shunting-yard algorithm with Stack
- Using Object Oriented design for extensibility
- Error handling in place
- Context of the error is available (position), easy to add error-friendly features
- CI/CD with Jest and Github Action, hosted on Github Pages
npm install
npm start
- Open
http://localhost:3000
in your browser
- Integration test
- Support parenthess
- Support more operators (unary: -X, binary: sin, max, etc)
- User-friendly error message
- Syntax analysis on the fly
- Store and display expression history