gyard 0.1.0

A generic shunting yard algorithm implementation
Documentation
  • Coverage
  • 100%
    23 out of 23 items documented2 out of 13 items with examples
  • Size
  • Source code size: 33.34 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.04 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Julian-Alberts/generic_shunting_yard
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Julian-Alberts

Generic Shunting Yard

Crates.io Crates.io GitHub Workflow Status (with branch)

The gyard crate is a generic implementation of the shunting yard algorythm with support for funtions. Not more not less.

use gyard::{InputToken, OutputToken, op::Math, to_postfix};
// 5 + 2 * sin(123)
let infix = [
    InputToken::Value(5),
    InputToken::Operator(Math::Add),
    InputToken::Value(2),
    InputToken::Operator(Math::Mul),
    InputToken::Function("sin"),
    InputToken::LeftParen,
    InputToken::Value(123),
    InputToken::RightParen,
];
let postfix = to_postfix(infix);
assert_eq!(postfix, Ok(vec![
    OutputToken::Value(5),
    OutputToken::Value(2),
    OutputToken::Value(123),
    OutputToken::Function("sin"),
    OutputToken::Operator(Math::Mul),
    OutputToken::Operator(Math::Add),
]));