summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-05-07 18:39:26 +0200
committerPeter Wu <peter@lekensteyn.nl>2016-05-07 19:00:41 +0200
commit534f174303fdb928b923d8e8de098b768e8f42ed (patch)
tree2743955410583b10a9eb2ec3d435588597478887
parent6e80be9599af0d70ac51637a871c0d1d076eb745 (diff)
downloadRegexTest-534f174303fdb928b923d8e8de098b768e8f42ed.tar.gz
grammar: remove EBNF constructs
I guess that this satisfies "A description of the grammar resulting from the transformation to remove EBNF constructs". It does not mention something about the left-associativity and priority rules, that is probably the next step.
-rw-r--r--grammar.txt21
1 files changed, 16 insertions, 5 deletions
diff --git a/grammar.txt b/grammar.txt
index 0a7a66e..fe6b235 100644
--- a/grammar.txt
+++ b/grammar.txt
@@ -1,8 +1,12 @@
start-symbol PROGRAM
context-free syntax
- PROGRAM ::= "begin" DECLS "|" (STATEMENT ";")* "end"
- DECLS ::= "declare" (ID ",")*
+ PROGRAM ::= "begin" DECLS "|" STATEMENTS "end"
+ DECLS ::= "declare" IDLIST
+ STATEMENTS ::= STATEMENT ";"
+ STATEMENTS ::=
+ IDLIST ::= ID ","
+ IDLIST ::=
context-free syntax
STATEMENT ::= ID ":=" EXP
@@ -16,13 +20,20 @@ context-free syntax
EXP ::= "(" EXP ")"
lexical syntax
- ID ::= [a-z][a-z0-9]*
+ ID ::= [a-z] ID'
+ ID' ::= [a-z0-9] ID'
+ ID' ::=
lexical syntax
- NAT ::= [0] | [1-9][0-9]*
+ NAT ::= [0]
+ NAT ::= [1-9] NAT'
+ NAT' ::= [0-9] NAT'
+ NAT' ::=
lexical syntax
- LAYOUT ::= [\ \n]*
+ LAYOUT ::= " " LAYOUT
+ LAYOUT ::= "\n" LAYOUT
+ LAYOUT ::=
context-free priorities
EXP ::= "-" EXP >