+++ /dev/null
-#ABNF 1.0;
-
-language "English (US)";
-tag-format <semantics/1.0>;
-root $input;
-
-$input =
- $zahl { $zahl }
- | $input plus $zahl { $input + $zahl }
- | $input minus $zahl { $input - $zahl }
-;
-
-$zahl =
- zero { 0 }
- | one { 1 }
- | two { 2 }
- | three { 3 }
- | four { 4 }
- | five { 5 }
- | six { 6 }
- | seven { 7 }
- | eight { 8 }
- | nine { 9 }
-;
-
-
-
-
+++ /dev/null
-#ABNF 1.0;
-
-language "English (US)";
-tag-format <semantics/1.0>;
-root $input;
-
-// right recursion for chain calculations is annoying because semantic evaluation will be right-to-left
-// and as a result subtraction will be wrong if implemented naively. The solution is to change to a separate
-// rule on subtraction, which reverses operation in following nodes (until another subtraction is found.
-$input =
- $zahl { $zahl }
- | $zahl plus $input { $zahl + $input }
- | $zahl minus $inputNeg { $zahl - $inputNeg }
-;
-$inputNeg =
- $zahl { $zahl }
- | $zahl plus $inputNeg { $zahl - $inputNeg }
- | $zahl minus $input { $zahl + $input }
-;
-
-$zahl =
- zero { 0 }
- | one { 1 }
- | two { 2 }
- | three { 3 }
- | four { 4 }
- | five { 5 }
- | six { 6 }
- | seven { 7 }
- | eight { 8 }
- | nine { 9 }
-;
-
-
-
-