https://github.com/maxxsoft/simple-calc
A simple calculator based on a recursive descent parser.
https://github.com/maxxsoft/simple-calc
Last synced: 8 months ago
JSON representation
A simple calculator based on a recursive descent parser.
- Host: GitHub
- URL: https://github.com/maxxsoft/simple-calc
- Owner: MaxXSoft
- License: gpl-3.0
- Created: 2017-02-05T07:03:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-09T08:33:43.000Z (over 9 years ago)
- Last Synced: 2025-06-22T13:07:31.170Z (12 months ago)
- Language: C++
- Size: 83 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-calc
A simple calculator based on a recursive descent parser.
### Usage
Build and then run in terminal. You will see this information:
```
a simple expression calculator by MaxXing
based on a recursive descent parser
input > _
```
Enter the mathematical expression ending with a question mark after the **input >** cursor. Like:
```
input > 1 + 1 ?
```
All of the spaces in your input will be ignored.
Then press enter:
```
input > 1 + 1 ?
result > 2.000000
input > _
```
The result is 2.
### Supported Operators
This calculator supports only the following operators:
* **Brackets:** (, )
* **Mathematical operation:** **, *, /, %, +, -
* **Bit operation:** <<, >>, &, ^, |
* **Logical operation:** <=, <, >=, >, ==, !=
### Reference
* LLVM Tutorial: [Kaleidoscope: Implementing a Parser and AST](http://llvm.org/docs/tutorial/LangImpl02.html)