https://github.com/farzonl/calc-repl
A cli calculator written with flex and bison.
https://github.com/farzonl/calc-repl
bison flex repl
Last synced: 7 months ago
JSON representation
A cli calculator written with flex and bison.
- Host: GitHub
- URL: https://github.com/farzonl/calc-repl
- Owner: farzonl
- Created: 2019-08-31T09:11:26.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-31T09:29:15.000Z (almost 7 years ago)
- Last Synced: 2025-04-12T02:14:11.120Z (over 1 year ago)
- Topics: bison, flex, repl
- Language: Yacc
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Calc-repl
A calculator reple with multi-type (int, float, & boolean) support, conditional exection, and assignment.
## Demo
coming soon...
## Dependencies
- flex
- bison
### install instructions mac
```
brew install flex bison
```
## Build instructions
```
make
```
## Run instructions
```
./calc
```
## expression examples:
### Assignment
```
a = 1
b = 2.2
c = true
d = false
```
### Integer Expressions
```
a = 1
1 + a * 3 - 2
c = a * 3 + 4
```
### Mixed Expressions
```
a = 1
b = 1.1 + a
c = 1.1 + 1
1 + 1.1
1.1 + 1 / 2
```
### Boolean expressions
```
true
!true
true == !false
a = false
true == a
a = 1==1.0
```
### Conditional expressions
```
a = false
if(a) {f = 1}
if(!a) {f = 1} else { f = 2}
if(!a) { 1 + 2 * 3} else { f = 2 * 4}
```