> (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 ~ 'cc' B
B ~ 'bb' A
A ~ 'a'
:discard ~ A
B is a simple L0 symbol, used in the lexeme C (*)
A is now on the RHS of non-lexeme match B, and in discard.
The effective structure (language?) we get after inlining
everything is
X ::= 'ccbba'
discard ~ 'a'
(*) This is a minimal case. We can nest arbitrarily deep away
from the lexeme.
I am fine with saying that this is also forbidden.
(b) X ::= C
C ~ 'cc'
B ~ 'bb' A
A ~ 'a'
:discard ~ A
In this case B is a simple L0 symbol which is not reachable
from any lexeme, and thus not from the start symbol either.
This could be ok, given that B is unreachable. I am fine
however with looking at this from the pure syntax level and
saying that it is forbidden.
> (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.
Actually <A> is not a lexeme. <B> is.
Even so, same answer as (4), A not allowed as both discard and RHS of lexeme B.
> (6) X ::= B B ~ 'a' A ~ 'a' :discard ~ A
>
> A bit strange,
Oh yes. Edge case. I am trying to think up all the ways a user may
unintentionally screw up, or intentionally try to break the system.
> but should be allowed.
Ok. Would have been a devil to check for if not.
> 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.
My reading is that
- The lexer attempts to match B and A in parallel.
At the end both match and the lexeme is passed up to G1.
This for every 'a'.
- Only exception is when B is not acceptable to G1.
Then LATM excludes it and only A matches and is discarded.
> ! hope these guesses were all correct and/or that this helps!
It does.
--
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.