diff options
Diffstat (limited to 'grammar.ebnf')
| -rw-r--r-- | grammar.ebnf | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/grammar.ebnf b/grammar.ebnf new file mode 100644 index 0000000..1805abb --- /dev/null +++ b/grammar.ebnf @@ -0,0 +1,16 @@ +(* Grammar definition in EBNF format. *) + +Expression = TermExpression; + +TermExpression = FactorExpression { ("+" | "-") FactorExpression }; + +FactorExpression = UnaryExpression { ("*" | "/") UnaryExpression }; + +UnaryExpression = ( "-" | "!" ) | GroupExpression; + +UnitExpression = NaturalDigit {Digit} | "(" Expression ")";; + +(* Basics *) + +NaturalDigit = "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"; +Digit = "0" | NaturalDigit ; \ No newline at end of file |
