(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 ~ A

As you said, a variant of (4), and same answer.  <A> is specified as a
lexeme and a lexeme can never occur on the RHS of an L0 rule.

(6) X ::= B  B ~ 'a'  A ~ 'a'  :discard ~ A

A bit strange,.but should be allowed.  My guess is that it accepts any
string of 1 or more "a"'s, using the first "a" in the parse and throwing
away the rest.

! hope these guesses were all correct and/or that 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.

Reply via email to