#calculator #repl #math

bin+lib calcula

A simple calculator library and command-line app

1 unstable release

new 0.1.0 Apr 2, 2025

#149 in #repl

Download history 127/week @ 2025-04-01

127 downloads per month

Apache-2.0

10KB

calcula

A simple calculator library and command-line app.

Gets input with rustyline, so emacs-style shortcuts are supported (Ctrl-A to move to the beginning of the line, Ctrl-E to move to the end of the line, Ctrl-U to clear, etc.). See their linked GitHub page for more information.

Planned Features

  • Interactive REPL mode or performing a single calculation as an argument
  • Rust-style variable bindings and number types (i32, u8, f64, etc.)
  • Functions
  • Built-in math library for constants like pi and operations like sin(2.0) sqrt(7.0)
  • Number literals in various bases (0xFF, 0b1010, 0o777 etc.)
  • Meta commands: :binary for printing as binary, :hex for printing as hex, :type for printing a variable's type, etc.
  • Bitfield operations ((0b1010 << 2) | 0b11)
  • Error handling: warning on overflow of datatypes

License

Licensed under Apache 2.

Dependencies

~5–12MB
~140K SLoC