From 690dfad4326293aef24c39db4be9abc19c8fb46e Mon Sep 17 00:00:00 2001 From: Mel Date: Sun, 17 Oct 2021 23:01:03 +0200 Subject: Lexing --- grammar.ebnf | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 grammar.ebnf (limited to 'grammar.ebnf') 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 -- cgit 1.4.1