Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chamini2/alex-happy-testing
Toy calculators for testing Alex and Happy
https://github.com/chamini2/alex-happy-testing
Last synced: about 4 hours ago
JSON representation
Toy calculators for testing Alex and Happy
- Host: GitHub
- URL: https://github.com/chamini2/alex-happy-testing
- Owner: chamini2
- Created: 2015-07-23T02:35:33.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-12T03:54:30.000Z (over 9 years ago)
- Last Synced: 2023-05-05T14:02:36.296Z (over 1 year ago)
- Language: Haskell
- Size: 152 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Alex-Happy-testing
Toy calculators for testing Alex and Happy## *Pure calculator*
**Prefix binary** operations with integers. The possible operations are `+`, `-`, `*` and `/`, an end of line can be commented with `# comment`.
#### Example
> + 10 5
15
> * + 10 5 20
300
> * 20 + 10 5 # comments are after `#`
300
> / 16 * 6 - 20 4 # equivalent to 16 / ((20 - 4) * 6)
0
> / 1 0 # in case of division by zero
-- división entre cero
> - 5 * 2 # in case of a parsing error
-- error de parseo
> # control-D to end the program**Note:** the "`> `" at the start of every line should be written by the program, not the user.
## *Stateful calculator*
**Infix binary** operations with integers and identifiers. The possible operations are `+`, `-`, `*` and `/`, parenthesis can be used `(` and `)`, an end of line can be commented with `# comment`.
To define a new identifier, use the syntax `let = `.
#### Example
> 10 + 5
15
> let x = 5 # first time `x` was seen
-- x creado
> (10 + x) * 20
300
> let x = x + 1 # in case of updating an identifier
-- x actualizado
> x
6
> 16 / (x * (20 - 4))
0
> x / 0
-- división entre cero
> - 5 * 2
-- error de parseo
>**Note:** the "`> `" at the start of every line should be written by the program, not the user.