https://github.com/remusao/hsbc
Haskell challenge to create a math expression evaluator, from scratch.
https://github.com/remusao/hsbc
Last synced: about 1 month ago
JSON representation
Haskell challenge to create a math expression evaluator, from scratch.
- Host: GitHub
- URL: https://github.com/remusao/hsbc
- Owner: remusao
- Created: 2017-02-10T12:28:15.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-15T17:13:51.000Z (over 8 years ago)
- Last Synced: 2025-02-15T07:20:12.106Z (3 months ago)
- Language: Haskell
- Size: 10.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hsbc
Haskell challenge to create an arithmetic expressions evaluator, from scratch.
## Goals
The goal of this project is to implement a basic (definition of basic can evolve over time), arithmetic expression evaluation command written in *Haskell*.
It should first return *correct results*, and then try to *be as fast as possible* (just for fun). The reference program that one can use is `bc`.The following operators should be supported:
* Integers of arbitrary size.
* Addition and substraction.
* Division and multiplication.
* Groupping of expressions with parenthesis.## Constraints
This problem should be solved in Haskell, with GHC >= 8.0.1, and **no external library is allowed** appart from the standard Prelude.
## Evaluation
Some basic test cases are provided in the `tests.txt` file, and you can run tests this way:
```sh
$ ./eval.sh
```For example:
```sh
$ ./eval.sh bc
............
real 0m0.049s
user 0m0.000s
sys 0m0.008s
```The file has the following format. Each test takes two lines, one expression, and the expected result. For example:
```sh
1 + 1
2
```