This is a simple calculator implemented using Lex and Yacc. It supports basic arithmetic operations, square root, exponentiation, and modulo operation.
- Basic Arithmetic Operations: The calculator can perform addition, subtraction, multiplication, and division.
- Square Root: The calculator can compute the square root of a number using the
sqrt()function. - Exponentiation: The calculator can perform exponentiation using the
^operator. - Modulo Operation: The calculator can perform modulo operation using the
%operator. - Error Handling: The calculator can handle syntax errors and division by zero errors.
- Commands: The calculator supports commands for displaying help instructions (
h) and quitting the application (q).
To use the calculator, simply enter an expression or a command. Here are some example expressions for each feature:
- Basic Arithmetic Operations:
- Addition:
2 + 3 - Subtraction:
5 - 2 - Multiplication:
4 * 5 - Division:
20 / 4
- Addition:
- Square Root:
sqrt(9) - Exponentiation:
2^3 - Modulo Operation:
10 % 3 - Commands:
- Display help instructions:
h - Quit the application:
q
- Display help instructions:
Please note that spaces are not allowed in the expressions.
This calculator was created by Ryan, Vihanga, Geemith, and Pramuditha © 2023.
This calculator is provided as-is, and the authors are not responsible for any errors or inaccuracies in the calculations. Always double-check your results with a trusted source.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please read the CONTRIBUTING.md file for details on how to contribute to this project.
If you have any questions or feedback, please feel free to contact the authors.
We would like to thank our professor and classmates for their valuable feedback and suggestions during the development of this calculator.