diff options
-rw-r--r-- | calc-example/calc.syntax | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/calc-example/calc.syntax b/calc-example/calc.syntax index 27c47a1..f739233 100644 --- a/calc-example/calc.syntax +++ b/calc-example/calc.syntax @@ -1,29 +1,29 @@ -_WHITESPACE = " " | "\t" | " "; -_COMMENT = "(*", {!"*)", <0, 0xFF>}, ("*)" | -); +_WHITESPACE = " " | "\t" | " "; +_COMMENT = "(*", {!"*)", <0, 0xFF>}, ("*)" | -); -_ = {_WHITESPACE | _COMMENT}; +_ = {_WHITESPACE | _COMMENT}; -DIGIT = <"0", "9">; +DIGIT = <"0", "9">; -ADD = _, ("+"), _; -SUB = _, ("-" | "−"), _; -MUL = _, ("*" | "⋅" | "×"), _; -DIV = _, ("/" | "∕" | "÷"), _; +ADD = _, ("+"), _; +SUB = _, ("-" | "−"), _; +MUL = _, ("*" | "⋅" | "×"), _; +DIV = _, ("/" | "∕" | "÷"), _; -sign = ADD | SUB; +sign = ADD | SUB; -unsigned = DIGIT, {DIGIT | _WHITESPACE | "_" | "'"}; +unsigned = DIGIT, {DIGIT | _WHITESPACE | "_" | "'"}; -_number = unsigned | "(", _expr, (")" | -); +_number = unsigned | "(", _expr, (")" | -); -number = _number, {_, _number}; (* optionally with implicit multiplication *) +number = _number, {_, _number}; (* optionally with implicit multiplication *) -value = [sign], number; +value = [sign], number; -_expr = hyper1; +_expr = hyper1; -hyper1 = _, hyper2, {(ADD | SUB), (hyper2 | -)}, _; -hyper2 = _, value, {(MUL | DIV), (value | -)}, _; +hyper1 = _, hyper2, {(ADD | SUB), (hyper2 | -)}, _; +hyper2 = _, value, {(MUL | DIV), (value | -)}, _; |