> The way Marpa checks internally is this
>
> 1.) Look for G1 symbols on a RHS, but not on a LHS -- these are the G1
> lexemes.
> 2.) Look for L0 symbols on a LHS, but not on a RHS -- these are the L0
> lexemes.
> 3.) The two sets of lexemes (G1 and L0) *should* be the same. If not, an
> error is
(a) X ::= CC ~ 'cc' BB ~ 'bb' A A ~ 'a':discard ~ A
Forbidden. is required to be a lexeme since it is a discard symbol,
and cannot appear on the RHS of an L0 rule.
(b) X ::= C C ~ 'cc' B ~ 'bb' A A ~ 'a' :discard ~ A
is *not* unreachable. It is an L0 lexeme, sinc
> (4)X ::= B B ~ 'bb' A A ~ 'a' :discard ~ A
>
> "A is both used as discard, and on the RHS of the lexeme B Is that allowed
> ?"
> No, it is not.
>
> "What if B is not a lexeme?" I'd want to see an example of what you have
> in mind before answering this.
(a) X ::= C
C
The way Marpa checks internally is this
1.) Look for G1 symbols on a RHS, but not on a LHS -- these are the G1
lexemes.
2.) Look for L0 symbols on a LHS, but not on a RHS -- these are the L0
lexemes.
3.) The two sets of lexemes (G1 and L0) *should* be the same. If not, an
error is reported.
Note
> OK! Quiz time! The following are off the top of my head, and untested:
>
> 1.) :start ::= A A ~ 'a'
>
> A is a lexeme and, yes, a lexeme should be OK as the start symbol.
Good.
> 2.) A ::= B C B ~ 'b' C ~ 'aa' B
>
> A lexeme is *NOT* OK on the RHS of an L0 rule,
Good. That is easy to
(4)X ::= B B ~ 'bb' A A ~ 'a' :discard ~ A
"A is both used as discard, and on the RHS of the lexeme B Is that allowed
?" No, it is not.
"What if B is not a lexeme?" I'd want to see an example of what you have
in mind before answering this.
(5)X ::= B B ~ A A ~ 'a' :discard ~
OK! Quiz time! The following are off the top of my head, and untested:
1.) :start ::= A A ~ 'a'
A is a lexeme and, yes, a lexeme should be OK as the start symbol.
2.) A ::= B C B ~ 'b' C ~ 'aa' B
A lexeme is *NOT* OK on the RHS of an L0 rule, so B is *NOT* a lexeme.
Since the grammar is il
Below a number of edge cases for slif grammars where I am not sure
about the legality. IOW if any of them are errors or not. And in the
latter case the behaviour of Marpa.
(1) = = == === = =
:start ::= A
A ~ 'a'
= = == === =