Skip to content

mushitoriami/suzuran

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

suzuran

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")))

About

An operator-precedence parser based on the Shunting Yard algorithm

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages