Skip to content

A math expression parser built with Rust & Web assembly ๐Ÿฆ€๐Ÿ•ธ

Notifications You must be signed in to change notification settings

tevs-rust-land/rust-calc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

67 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Rust-Calc

image

This Project has 3 parts

  1. Engine -> /calc_engine
  2. Wasm wrapper -> wasm
  3. The small UI -> www

The Engine

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

Wasm Wrapper

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

Installing via npm

Install the wasm wrapper from https://www.npmjs.com/package/wasm-calc/v/0.3.3

The UI

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 image

Unexpected character image

Unterminated expression image

This project has been made possible by Rust & WebAssembly ๐Ÿฆ€ + ๐Ÿ•ธ

About

A math expression parser built with Rust & Web assembly ๐Ÿฆ€๐Ÿ•ธ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published