This Project has 3 parts
- Engine -> /calc_engine
- Wasm wrapper -> wasm
- The small UI -> www
The Engine has been built in rust with 0 dependencies. The scanner & parser are written by hand. Im using top-down recursive descent to parse & evaluate the expression given.
Check out the examples
folder in the calc_engine
directory to see how it can be used.
Crate Link
The wasm wrapper is really just a wrapper for the engine which makes it accessible to browser clients.
It really just has 1 function. calculate
which passes the input to the engine. The wrapper has been built with wasm-pack
Install the wasm wrapper from https://www.npmjs.com/package/wasm-calc/v/0.3.3
The UI is just a 1 page app built with Next that takes the expression from an input & returns the result or the error incase a bad expression was encountered. Happy path
This project has been made possible by Rust & WebAssembly ๐ฆ + ๐ธ