#algebra #parser #rpn #shunting-yard #convert

bin+lib squiid-parser

The algebraic expression parser for Squiid Calculator

3 stable releases

Uses new Rust 2024

1.5.2 Mar 12, 2025
1.5.0 Mar 11, 2025

#653 in Parser implementations

Download history 303/week @ 2025-03-09 44/week @ 2025-03-16 8/week @ 2025-03-23

355 downloads per month

GPL-3.0 license

35KB
477 lines

Squiid Parser

Squiid Parser is the algebraic expression parser for Squiid Calculator, designed to parse infix notation into postifix (RPN) notation, which can then be evaluated by squiid-engine. It is implemented in Rust to ensure high performance and safety.

Features

  • Fast and memory-safe algebraic (infix) to RPN (postfix) conversion
  • Well-documented API
  • Error handling with the prohibition of unwrap()/expect()
  • Able to be used through a variety of different languages through the bindings

Installation

cargo add squiid-parser

Example Usage

use squiid_parser::parse;

fn main() {
    // Parse an algebraic expression: (3 + 5 * 7)
    let result = parse("(3+5*7)");

    assert_eq!(result, vec!["3", "5", "7", "*", "+"]);
}

License

Squiid Parser is licensed under GPLv3.

Compiling

To compile the shared object file for use in bindings, just run install Rust and run cargo build --release --lib --features=ffi. The shared object file should be found in target/release/libsquiid_parser.so.

Dependencies

~1.7–9.5MB
~61K SLoC