Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D2L -- multiple grammars. #13

Open
jeffreykegler opened this issue May 2, 2015 · 5 comments
Open

D2L -- multiple grammars. #13

jeffreykegler opened this issue May 2, 2015 · 5 comments

Comments

@jeffreykegler
Copy link
Collaborator

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.)

@rns
Copy link
Owner

rns commented May 2, 2015

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.

@jeffreykegler
Copy link
Collaborator Author

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.

@rns
Copy link
Owner

rns commented May 3, 2015

Fixed in b9b2554.

@jeffreykegler
Copy link
Collaborator Author

Hmmm. Interesting idea.

On Sat, May 2, 2015 at 11:41 PM, rns notifications@github.com wrote:

Fixed in b9b2554
b9b2554
.


Reply to this email directly or view it on GitHub
#13 (comment).

@rns
Copy link
Owner

rns commented May 5, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants