Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scenent/cpp-eval
evaluate an expression in C++.
https://github.com/scenent/cpp-eval
evaluate-expressions
Last synced: 5 days ago
JSON representation
evaluate an expression in C++.
- Host: GitHub
- URL: https://github.com/scenent/cpp-eval
- Owner: scenent
- License: mit
- Created: 2023-08-01T12:29:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-05T02:34:34.000Z (over 1 year ago)
- Last Synced: 2024-11-15T02:29:27.670Z (2 months ago)
- Topics: evaluate-expressions
- Language: C++
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cpp-eval
## preview
```cpp
1 + 2 -> [Int, "3"]
1.0 + 2.0 -> [Float, "3.000000"]
1 + 2 * 3 -> [Int, "7"]
(1 + 2) * 3 -> [Int, "9"]
1 + 2 == 3 -> [True, "true"]
1 + 2 == 3 and 2 * 3 == 6 -> [True, "true"]
0 == 1 or 1 == 1 -> [True, "true"]
1 * 2 == 2 or 0 == 1 and 1 * 3 == 3 or 0 == 1 -> [True, "true"]
1 == 1 and 2 == 2 and 3 != 3 -> [False, "false"]
"Hello" + " " + "World!" -> [String, "Hello World!"]
true and false -> [False, "false"]
-(1 + 2 * 3) -> [Int, "-7"]
not 1 == 1 or not 1 == 2 -> [True, "true"]
-cos(0) + sin(0) + tan(0) -> [Float, "-1.000000"]
sin 1 -> [Float, "0.841471"]
pow((1 * 4), 2) + 4 -> [Float, "20.000000"]
```