In many programming language string is a token.
For example:
token ::= '"' string
| digit nat
string ::= char string
| '"'
nat ::= digit nat
| ϵ
This is a LL(1) grammar for some programming language's toke grammar.
When parsing a string
, there is no need to check follow set, because there is a "
at the end of each string
.
Comparing with nat
, string
is more easy to parse.
My question is
Is there any official terminology about this kind of grammar?
Thanks.
Editing:
There was some mistake in the original grammar, thanks @rici for pointing out my mistakes.