diskmat-tools/src/boolean_algebra/boolean_algebra.pest

12 lines
335 B
Plaintext
Raw Normal View History

2022-03-03 12:53:48 +01:00
boolean_algebra = { SOI ~ expression ~ EOI }
expression = { negatable_term ~ (binop ~ negatable_term)* }
negatable_term = _{ negated | term }
negated = ${ negation ~ term }
term = _{ label | "(" ~ expression ~ ")" }
negation = _{ "!" | "~" }
binop = @{ or_op | and_op }
and_op = _{ "" }
or_op = _{ "+" }
label = @{ ASCII_ALPHA }