Skip to content

Simulates binary numbers, logic gates, and arithmetic circuits to perform basic integer math

Notifications You must be signed in to change notification settings

kevlarr/rusty-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rusty Calculator

Or, A Pointlessly Complex Calculator Prompt

Performs basic integer math without using numbers or operations by simulating logic gates and arithmetic circuits.

Usage

With Rust 1.29+ and cargo installed:

  1. git clone https://github.com/kevlarr/rusty-calc
  2. cd rusty-calc
  3. cargo run -- -i for an interactive prompt, or cargo run -- '4,000 + 12 * 3' for a single calculation
  4. Make fun of it

TODO

  • Support float

Expression parsing

  • Parse simple binary arithmetic operations
  • Support operator precedence without requiring parentheses
  • Support nested expressions via parentheses

Circuits

  • Add
  • Subtract
  • Multiply
  • Divide
  • Exponentiation
  • Modulo

About

Simulates binary numbers, logic gates, and arithmetic circuits to perform basic integer math

Resources

Stars

Watchers

Forks

Languages