-
Notifications
You must be signed in to change notification settings - Fork 38
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
Support composite grammars. #25
Comments
Another way to do this would be to support external and/or custom implemented rules. something like this:
|
I'm now convinced that this should be done similar to the following:
And, of course, other Pegasus parsers could be invoked more simply once #42 is implemented:
|
Slightly better syntax idea, using the previous example.
Allowing this anywhere would be nifty and would very easily lead to higher-order rules (#32). |
How do we deal with left-recursion and zero-width detection, given the above scheme? |
I think we will assume that custom rules will potentially be zero-width and that they may be assertions. We will allow reentrancy at the programmers own risk. Know what you are doing, but nesting languages should be allowed. It is the programmers responsibility to handle left-recursion properly. |
Here's a proposed syntax for the most complex case I can imagine (calling another parser, and copying its result into the lexical collection):
It would simplify significantly for other Pegasus parsers that eventually expose
|
This is completed in the develop branch. |
It would be nice to have a grammar library where you could import a grammar, something like this (syntax tentative):
Now that the grammar is included, you would then be able to do something like this:
This would allow reuse and embedding of other grammars.
The text was updated successfully, but these errors were encountered: