aboutsummaryrefslogtreecommitdiffstats
path: root/calc-example/calc.syntax
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-19 11:32:44 +0200
committerMattias Andrée <maandree@kth.se>2021-04-19 11:32:44 +0200
commitf59c0afc2b5155417a3f7d1f36fd0481ce87ab15 (patch)
tree62cf9909213abf99d4cbae16ba3053e78c771b29 /calc-example/calc.syntax
parentm (diff)
downloadlibparser-f59c0afc2b5155417a3f7d1f36fd0481ce87ab15.tar.gz
libparser-f59c0afc2b5155417a3f7d1f36fd0481ce87ab15.tar.bz2
libparser-f59c0afc2b5155417a3f7d1f36fd0481ce87ab15.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--calc-example/calc.syntax32
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 | -)}, _;