The Arithmetic Calculator will help you calculate mathematical expressions with operations such as Addition, Subtraction, Multiplication, and Division. It uses a custom-built Lexer, Parser, and Evaluator to provide accurate results and flexibility.
You can check out the live preview here: https://pradeepkumarverma1.github.io/calculator/
- Replaced the original evaluator with a custom-built lexer.
- Lexer now handles tokenization of mathematical expressions, breaking them down into operators, numbers, and identifiers.
- Developed a custom parser that constructs an Abstract Syntax Tree (AST) from the tokenized input.
- Supports basic mathematical expressions with operator precedence:
- Multiplication and division have higher precedence than addition and subtraction.
- Evaluator traverses the AST and calculates the result based on operator precedence.
- The parser and evaluator will be further extended to handle parentheses in mathematical expressions for full order of operations support (e.g.,
(2 + 3) * 2
).
2. Fix the issue with appending the '-' sign: The expression 3 * - 2
is currently not handled properly. Need to resolve this.
- Web browser (Chrome, Firefox, Safari, etc.)
-
Clone the repository:
git clone https://github.com/pradeepkumarverma1/calculator.git