GoCalc is an advanced, interactive command-line calculator written in Go. It combines the simplicity of a basic calculator with the power of a scientific computing tool.
- Interactive REPL (Read-Eval-Print Loop) interface
- Complex mathematical expressions
- Basic arithmetic operations (+, -, *, /, ^)
- Trigonometric functions (sin, cos, tan)
- Logarithmic and exponential functions
- Variable storage and recall
- Parentheses for expression grouping
-
Ensure you have Go installed on your system. If not, download and install it from golang.org.
-
Clone the repository:
git clone https://github.com/Bansnetsajak007/GoCalc.git cd gocalc
-
Build the project:
go build
Run the program:
./gocalc
Once started, you can enter mathematical expressions. For example:
> 2 + 3 * 4
Result: 14
> sin(pi/2)
Result: 1
> x = 5
x = 5
> y = x^2 + 3
y = 28
> sqrt(y)
Result: 5.291502622129181
Special commands:
vars
: Display all stored variablesexit
: Quit the program
main.go
: Entry point of the applicationevaluator/
: Package for expression evaluationlexer/
: Package for tokenizing inputrepl/
: Package for the interactive interface