Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryansilva2004/simple-lex-yacc-calculator
This is a simple calculator implemented using Lex and Yacc. It supports basic arithmetic operations, square root, exponentiation, and modulo operation. It also handles syntax errors and division by zero errors.
https://github.com/ryansilva2004/simple-lex-yacc-calculator
calculator lexical-analyzer yacc-lex
Last synced: 3 days ago
JSON representation
This is a simple calculator implemented using Lex and Yacc. It supports basic arithmetic operations, square root, exponentiation, and modulo operation. It also handles syntax errors and division by zero errors.
- Host: GitHub
- URL: https://github.com/ryansilva2004/simple-lex-yacc-calculator
- Owner: RyanSilva2004
- Created: 2023-11-11T09:44:10.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-11T09:58:20.000Z (about 1 year ago)
- Last Synced: 2024-11-28T20:13:21.586Z (2 months ago)
- Topics: calculator, lexical-analyzer, yacc-lex
- Language: C
- Homepage:
- Size: 866 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Lex/Yacc Calculator
This is a simple calculator implemented using Lex and Yacc. It supports basic arithmetic operations, square root, exponentiation, and modulo operation.
## Features
- **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`).## Usage
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`
- **Square Root**: `sqrt(9)`
- **Exponentiation**: `2^3`
- **Modulo Operation**: `10 % 3`
- **Commands**:
- Display help instructions: `h`
- Quit the application: `q`Please note that spaces are not allowed in the expressions.
## Authors
This calculator was created by Ryan, Vihanga, Geemith, and Pramuditha © 2023.
## Disclaimer
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.
## License
This project is licensed under the MIT License. See the LICENSE file for details.
## Contributing
Contributions are welcome! Please read the CONTRIBUTING.md file for details on how to contribute to this project.
## Contact
If you have any questions or feedback, please feel free to contact the authors.
## Acknowledgments
We would like to thank our professor and classmates for their valuable feedback and suggestions during the development of this calculator.