Skip to content

Blazingly Fast terminal calculator that compiles your calculations to Web Assembly on the fly πŸ”₯

Notifications You must be signed in to change notification settings

jacobvm04/rcalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RCalc

Have you ever been twiddling your thumbs waiting for your calculator to finish calculating? Probably not, but here's an over-engineered solution anyway

rcalc is the fastest calculator for your terminal out there. rcalc carries out your math calculations πŸ”₯ blazingly fast by compliling your expressions to Web Assembly on the fly πŸ”₯ 😎

I built this project mostly as an excuse to learn about writing parser cominbators in rust using chumsky along with the basics of building a JIT compiler targeting Web Assembly using wasm-encoder and wasmtime.

Usage

> rcalc '1 + 1 * 2 / 4'
1.4998751

Malformed input example

❯ rcalc 2 -+3
Failed to parse input expression
Error: found + expected '(', or '-'
   ╭─[<unknown>:1:4]
   β”‚
 1 β”‚ 2 -+3
   β”‚    ┬
   β”‚    ╰── found + expected '(', or '-'

Installation

To install rcalc, clone this repo and run cargo install --path . in the cloned directory. Do note that this project requires rust nightly to build.

Tests

This project uses proptest for property based testing. To run the tests, simply run

> cargo test # or `cargo nextest run` if you have `cargo-nextest` installed

For code coverage, install cargo-llvm-cov and run

cargo llvm-cov

About

Blazingly Fast terminal calculator that compiles your calculations to Web Assembly on the fly πŸ”₯

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages