WaferCalc (previously Wafer) is a scriptable stack-based calculator for the terminal. It supports custom scripting, user-defined commands, and a variety of mathematical operations. WaferCalc is designed to be lightweight, extensible, and powerful for quick calculations or complex scripts.
- Stack-based Operations: Perform operations directly on a stack of values.
- Scriptable: Define custom commands and scripts to extend functionality.
- Built-in Math: Includes a wide range of mathematical functions like trigonometry, logarithms, and power operations.
- Custom Configuration: Load and save default scripts for personalized setups.
- Interactive REPL: Use WaferCalc in an interactive terminal session.
You can clone the repository and build using the dotnet CLI
git clone https://github.com/zeaga/WaferCalc.git
cd WaferCalc
dotnet buildRun WaferCalc without arguments to enter an interactive REPL mode:
WaferCalcAfter that you can type commands and see results in real time:
:: 3 4 +
7
Pass commands as arguments:
WaferCalc 3 4 +WaferCalc automatically loads a default script (Wafer.conf) located in the executable's directory. Modify this file to customize your environment.
- Arithmetic:
+,-,*,/,**(power) - Logical:
and,or,not,xor - Stack Manipulation:
dup,swap,rot,drop,empty,count - Control Flow:
{ ... }for loops - Trigonometry:
sin,cos,tan - Utilities:
help,exit,cls
You can define your own commands or modify the default script for custom functionality:
square: dup *
:: 5 square .
25
WaferCalc is written in C# and leverages the .NET runtime. Contributions and suggestions are welcome!
Engine.cs: Core functionality, including stack operations and command processing.Extensions.cs: Utility extensions for stack operations.Program.cs: Entry point and REPL implementation.
- Fork the repository.
- Create a feature branch.
- Submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or suggestions, feel free to open an issue.