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 ill-formed, I'll pass on the question about <C>. 3. ) A ::= B C B ~ 'b' C ~ B Same problem. B is a lexeme, but cannot appear on the RHS of an L0 rule, and therefore the grammar is ill-formed. I'll deal with the last 3 separately. I hope this helps! On Wed, Mar 29, 2017 at 8:46 PM, Andreas Kupries <[email protected]> wrote: > > 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' > = = == === ===== ======== > > Is A a lexeme ? > Is a lexeme allowed as the G1 start symbol ? > > (2) = = == === ===== ======== ============= > A ::= B C > B ~ 'b' > C ~ 'aa' B > = = == === ===== ======== > > A is a G1 symbol. > B is a lexeme. > > Is C a lexeme ? > Is it allowed to use a lexeme on the RHS of a match rule ? > > (3) = = == === ===== ======== ============= > A ::= B C > B ~ 'b' > C ~ B > = = == === ===== ======== > > A variant of (2) where C is reduced to be an alias of B. > Does that change the answers ? > > (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 ? What if B is not a lexeme ? > > (5) = = == === ===== ======== ============= > X ::= B > B ~ A > A ~ 'a' > discard ~ A > = = == === ===== ======== > > A variant of (4) where the regular match B was reduced to be > an alias of the discard match. > > (6) = = == === ===== ======== ============= > X ::= B > B ~ 'a' > A ~ 'a' > discard ~ A > = = == === ===== ======== > > And a variant of (5, 6) where the symbols are definitely > separate, but the underlying definitions are structurally > identical. > > This could also be written as > > = = == === ===== ======== ============= > X ::= B > B ~ 'a' > discard ~ 'a' > = = == === ===== ======== > > -- > See you, > Andreas Kupries <[email protected]> > <http://core.tcl.tk/akupries/> > Developer @ SUSE > > Tcl'2017, Oct 16-20, Houston, TX, USA. http://www.tcl.tk/community/ > tcl2017/ > EuroTcl 2017, Jul 8-9, Berlin/DE, http://www.eurotcl.tcl3d.org/ > ------------------------------------------------------------ > ------------------- > > > > > -- > You received this message because you are subscribed to the Google Groups > "marpa parser" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
