https://github.com/sj14/calc
🧮 Calc is a prototype of a calculator with basic algebraic simplification written in Go.
https://github.com/sj14/calc
Last synced: 9 months ago
JSON representation
🧮 Calc is a prototype of a calculator with basic algebraic simplification written in Go.
- Host: GitHub
- URL: https://github.com/sj14/calc
- Owner: sj14
- Created: 2016-02-25T21:43:32.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-05-11T11:03:51.000Z (over 7 years ago)
- Last Synced: 2025-04-02T04:50:30.294Z (10 months ago)
- Language: Go
- Homepage: https://sj14-calc.herokuapp.com/
- Size: 292 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Calc
Calc is a prototype of a calculator with basic algebraic simplification written in Go.
# Screenshot

# Features
* Basic algebraic simplification (e.g. x+x = 2*x)
* Base conversion (binary, octal and hexadecimal to decimal)
* Web interface for input and output (based on bootstrap)
# Usage
* go get github.com/sj14/calc
* cd $GOPATH/src/github.com/sj14/calc
* go run main.go
* open a web browser and enter http://localhost:9000/
# Basic architecture
1. Decide (regex) the input type (base conversion or mathematical term) (relay)
## Base Conversion
2. Do base conversion (relay)
3. Show result
## Algebraic simplification
2. Convert the input term into an Abstract Syntax Tree (shuntingyard)
3. Evaluate the AST (eval)
4. Show the result
# Problems / Limitations / TODO
* The traversing order of the AST is from right to left instead left to right
* No unary operations (e.g. -5 will result into 0-5)
* Usage of float64 instead of math/big
* Make usage of steps.go
* ...