libdice 0.1.0

A package for parsing simple dice-rolling expressions
Documentation
WHITESPACE = _{ " " | NEWLINE | "\t" }

integer = @{ ASCII_DIGIT+ }

un_op = _{ minus | undice }
	minus = { "-" }
	undice = { "d" }

bin_op = _{ add | subtract | multiply | divide | bindice }
	add = { "+" }
	subtract = { "-" }
	multiply = { "*" }
	divide = { "/" }
	bindice = { "d" }

primary = _{ integer | "(" ~ expr ~ ")" }
atom = _{ un_op* ~ primary }
expr = { atom ~ (bin_op ~ atom)* }
equation = _{ SOI ~ expr ~ EOI }