Open jeffreykegler opened 9 years ago
D2L currently has no special syntax to define lexical rules, my thought (in the passage about luif.grammar_new()
and luif.grammar_loadstring()
) was that they can be inferred and the lexical grammar auto-built.
Now that D2L must produce KIR, is it ok to infer lexical rules to produce the linked lexical grammar for the structural?
On the second thought, '~'
can mark lexical rules by being the first field in a rule table, just as '|'
and '||'
that can make the code simpler which can be a good thing to start with.
D2L needs to allow the grammar to be specified in some way. Even if we stick intially to G1/L0, in practical applications some L0 rules will need to be defined directly as L0 rules, rather than indirectly as charclasses and strings in L0 rules.
Fixed in b9b2554.
Hmmm. Interesting idea.
On Sat, May 2, 2015 at 11:41 PM, rns notifications@github.com wrote:
Fixed in b9b2554 https://github.com/rns/kollos-luif-doc/commit/b9b2554dd3d2e756b6f76c746576a3f8d7f8128b .
— Reply to this email directly or view it on GitHub https://github.com/rns/kollos-luif-doc/issues/13#issuecomment-98443502.
Another option can be a special key, e.g. lexical
in the structural grammar table, which must contain all lexical rules. I think lexical rules can in theory be precedenced (can they?) and, in that case, '~'
as the first field followed by '|'
or '||'
doesn't seem to be a good idea.
Unlike in LPeg, we'll have to deal with grammar sets. PEG has unified lexing/parsing, whereas typically Marpa will have at least a G1/L0 pair. (This is the same matter that I did not get right in my first pass at the LUIF.)