summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--minicc.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/minicc.cpp b/minicc.cpp
index 704c465..26a88d4 100644
--- a/minicc.cpp
+++ b/minicc.cpp
@@ -68,11 +68,26 @@ protected:
};
TEST_F(Test, BNF) {
+ BNF LexBNF{
+ {"preprocessing-token", {{"identifier"},
+ {"preprocessing-op-or-punc"},
+ {"pp-number"}}},
+
+ {"identifier", {{"identifier-nondigit"},
+ {"identifier", "identifier-nondigit"},
+ {"identifier", "digit"}}},
+ {"digit", {{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }}},
+ {"identifier-nondigit", {{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
+ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "_"}}},
+ {"preprocessing-op-or-punc", {{";"}}},
+ {"pp-number", {{"digit"}, {"pp-number", "digit"}}}
+ };
+
std::string Top{"program"};
BNF bnf{
{"program", {{"statement-list"}}},
- {"statement-list", {{"statement", "statement-list"}}},
- {"statement-list", {}},
+ {"statement-list", {{"statement", "statement-list"},
+ {}, }},
{"statement", {{"assigmnent", ";"}}},
{"assignment", {{"identifier", "=", "identifier"}}}
};