An open API service indexing awesome lists of open source software.

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.

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}
```