Skip to content
This repository was archived by the owner on Apr 27, 2025. It is now read-only.

zeaga/WaferCalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WaferCalc

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.

Features

  • 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.

Installation

You can clone the repository and build using the dotnet CLI

git clone https://github.com/zeaga/WaferCalc.git
cd WaferCalc
dotnet build

Usage

Interactive Mode

Run WaferCalc without arguments to enter an interactive REPL mode:

WaferCalc

After that you can type commands and see results in real time:

 :: 3 4 +
7

Script Mode

Pass commands as arguments:

WaferCalc 3 4 +

Default Configuration

WaferCalc automatically loads a default script (Wafer.conf) located in the executable's directory. Modify this file to customize your environment.

Core Commands

  • 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

Extensibility

You can define your own commands or modify the default script for custom functionality:

square: dup *
 :: 5 square .
25

Development

WaferCalc is written in C# and leverages the .NET runtime. Contributions and suggestions are welcome!

Folder Structure

  • Engine.cs: Core functionality, including stack operations and command processing.
  • Extensions.cs: Utility extensions for stack operations.
  • Program.cs: Entry point and REPL implementation.

Contributing

  1. Fork the repository.
  2. Create a feature branch.
  3. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or suggestions, feel free to open an issue.

About

Scriptable stack-based calculator for the terminal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages