Skip to content
Simple mathematical expression evaluator (aka calculator) built using Nom, Pratt Parser, LLVM, Cranelift and Relm.
Rust
Branch: master
Clone or download
Latest commit b165d8b Nov 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
calculator-cli Initial commit Nov 25, 2019
calculator-engine Initial commit Nov 25, 2019
calculator-gtk
calculator-repl Initial commit Nov 25, 2019
.gitignore Initial commit Nov 25, 2019
Cargo.lock Initial commit Nov 25, 2019
Cargo.toml Initial commit Nov 25, 2019
README.md

README.md

Calculator

Simple mathematical expression evaluator (aka calculator) built using Nom, Pratt Parser, LLVM, Cranelift and Relm.

Every mathematical expression is parsed to lexical tokens using Nom. After initial parsing is complete, Pratt Parser algorithm is used to create AST (Abstract Syntax Tree) with right operator precedence.

There is simple interpreter implementation, which visits every AST node and computes result.

Alongside interpreter there is JIT compiler implementation with Cranelift and LLVM backends.

For end-user every mathematical expression is evaluated simultaneously by the interpreter and JIT compiler. JIT and Interpretator are racing to compute value first.

Crate name Description
calculator_engine Implementation of expression parser and execution modules
calculator_cli Simple CLI interface that reads input from command line arguments CLI
calculator_repl REPL with built-in basic syntax highlighting REPL
calculator_gtk Simple cross-platform GTK GUI GTK UI
You can’t perform that action at this time.