From c82f53c34625d2336ddad112cb19ac4d70efc6e2 Mon Sep 17 00:00:00 2001 From: John Doty Date: Sat, 15 Jun 2024 06:18:04 -0700 Subject: [PATCH] Document the decision --- TODO | 1 - tests/test_grammar.py | 13 ++++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 70197ad..9f4739c 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,2 @@ -- Make terminal and nonterminal spaces disjoint, allow gammars to name them the same way - Generate LALR lookaheads directly from LR0 states, not as LR1 + Merge, for speed (Alternately, implement the Pager/Chen algorithm on LR1 for state merging) \ No newline at end of file diff --git a/tests/test_grammar.py b/tests/test_grammar.py index 3845990..23bfee2 100644 --- a/tests/test_grammar.py +++ b/tests/test_grammar.py @@ -3,7 +3,18 @@ import pytest def test_conflicting_names(): - """Terminals and nonterminals can have the same name.""" + """Terminals and nonterminals cannot have the same name. + + I think that ultimately this gives a nicer experience, in error messages and + understandability. The input grammar can distinguish between them throughout, + and the system can always be unambiguous when it's working, but at times it + needs to report errors or display the grammar to humans. There is no clean + notation I can use at that time to distinguish between a terminal an a + nonterminal. + + I think this restriction ultimately makes the grammars and the tooling easier + to understand. + """ IDENTIFIER = parser.Terminal("Identifier")