Closed JohnnyWalkerDigital closed 3 years ago
On the other hand, it has the traits of a "simple regular grammar" because it can repeat, but can't count.
When it says "a regular grammar can repeat, but it can't count" it's not referring to the Lox language (which is indeed not regular). It's making a statement about regular languages in general. Reworded stuff to hopefully be clearer.
If it's at all possible (and it may not be possible) it would be great if the same terminology could be used consistently. I'm often very confused as to what's being referred to.
Consider the following in Section 5.1.1: Representing Code - Rules for Grammars (https://craftinginterpreters.com/representing-code.html#rules-for-grammars)
And then in the sidenote:
So... is the language regular or isn't it?
On the one hand this language is "context-free" (not "not regular") because it has "nested recursion where the recursive nonterminal has productions on both sides". On the other hand, it has the traits of a "simple regular grammar" because it can repeat, but can't count.
I'm sure I'm missing something, but I found it very confusing. I'd like to have faith in the terminology used through the book.