https://github.com/egor-tensin/math-server
Calculator with a telnet interface
https://github.com/egor-tensin/math-server
Last synced: 7 months ago
JSON representation
Calculator with a telnet interface
- Host: GitHub
- URL: https://github.com/egor-tensin/math-server
- Owner: egor-tensin
- License: mit
- Created: 2019-11-29T22:11:45.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-28T12:08:51.000Z (over 1 year ago)
- Last Synced: 2025-01-11T21:23:31.582Z (9 months ago)
- Language: C++
- Homepage:
- Size: 174 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
math-server
===========[](https://github.com/egor-tensin/math-server/actions/workflows/ci.yml)
Development
-----------Build using CMake.
Depends on Boost.{Filesystem,Program_options,Regex,Test}.There's a Makefile with useful shortcuts to build the project in the build/
directory along with the dependencies:make deps
make build
make testUsage
-----### `math-server`
If you just run `math-server`, it'll start a server on port 18000.
You can `telnet` to it, type in arithmetic expressions, and it'll give you the
results:1
1
2 * 2
4
1 / (3 - -3)
0.16666666666666666
1 / (-3 - -3)
server error: parser error: division by zero
-4 ^ 2
-16
(-4) ^ 2
16Consult `math-server --help` for more info.
### `math-client`
A `telnet`-like client for the server.
It'll try to connect to the server on localhost:18000.Supports reading input from:
* the command line,
> math-client -c "2 * 2"
4* a file(s),
> math-client test.txt
result1
result2* stdin.
> math-client
1
1
2 * 2
4
1 / (3 - -3)
0.16666666666666666
1 / (-3 - -3)
server error: parser error: division by zero
-4 ^ 2
-16
(-4) ^ 2
16Consult `math-client --help` for more info.
### Docker
Start the server using
docker-compose pull && docker-compose up -d server
Connect to localhost:18000 to query it or run the client:
> docker-compose run --rm client -c "69 * 420"
28980> docker-compose run --rm client
12 * 12
144
asdf
server error: lexer error: invalid input at: asdfLicense
-------Distributed under the MIT License.
See [LICENSE.txt] for details.[LICENSE.txt]: LICENSE.txt