> 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 in this way of doing things, the order of rules plays no role, not
> even in the generation of the error message.  Marpa doesn't even try to
> figure out what's a lexeme until both grammars are fully formed.

Yes, I can see that.

Whereas I am going at it from the point of catching issues early.

I do this by

- Label all symbols on first encounter with an initial tag, depending
  the initial context (G1/L) LHS/RHS :lexeme, ...)

- When the symbol is encountered again later the new context either
  induces a state transition to a different tag, or throw an ERROR.

The possible tags thus encodes the entire knowledge gained so far
about an item. And the entirety of (tag,context --> tag|error) is a
nice DFA with the semantics running one instance of it per symbol
found.

I constructed the shown edge cases from the rows of the DFA where it
was not clear to me if the situation was an error or not.

> The above ignores some details.  For example, there is a :lexeme
> pseudo-rule, and any symbol specified in one of these pseudo-rules is
> required to also be both a L0 lexeme and a G1 lexeme, by the above
> definitions.

Correct.

-- 
See you,
        Andreas Kupries <akupr...@shaw.ca>
                        <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 marpa-parser+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to