diff options
| author | Mel <einebeere@gmail.com> | 2021-10-17 23:01:03 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2021-10-17 23:02:15 +0200 |
| commit | 690dfad4326293aef24c39db4be9abc19c8fb46e (patch) | |
| tree | 28720fa163cec7c6ed04e054d7d0d8ea133373b7 /grammar.ebnf | |
| download | rabbithole-690dfad4326293aef24c39db4be9abc19c8fb46e.tar.zst rabbithole-690dfad4326293aef24c39db4be9abc19c8fb46e.zip | |
Lexing
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 |
