| Crates.io | suzuran |
| lib.rs | suzuran |
| version | 0.1.1 |
| created_at | 2025-10-04 21:57:10.194188+00 |
| updated_at | 2025-10-05 11:30:41.174245+00 |
| description | An operator-precedence parser based on the Shunting Yard algorithm |
| homepage | |
| repository | https://github.com/mushitoriami/suzuran |
| max_upload_size | |
| id | 1868431 |
| size | 11,319 |
An operator-precedence parser based on the Shunting Yard algorithm
let mut parser = suzuran::Parser::new(["+", "*"]);
println!("{:?}", parser.parse(["1", "+", "2", "*", "3"]).unwrap());
// Operator("+", Primitive("1"), Operator("*", Primitive("2"), Primitive("3")))
parser = suzuran::Parser::new(["+", "-", "*"]);
println!("{:?}", parser.parse(["-", "(", "1", "+", "2", ")", "*", "3"]).unwrap());
// Operator("-", Placeholder, Operator("*", Parentheses(Operator("+", Primitive("1"), Primitive("2"))), Primitive("3")))