-
Notifications
You must be signed in to change notification settings - Fork 126
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
Allow for rules that don't create separate nodes #36
Comments
But then wouldn't you have to repeat the visitation code (e.g. If we do this, here's a spelling idea:
That's consistent with, or at least reminiscent, of the term-silencing syntax proposed in #29 (comment). |
I suppose suppressing node formation might not be as disastrous if you aren't using NodeVisitor. But I can't help thinking that, whatever you write to process the tree, you'll end up repeating yourself if you don't let |
If you take
Here, you don't really care about |
It's often useful to define some basic rules that can be composited to form larger expressions:
However, there is not always any reason why each separate
digit
needs its own node, even if it's useful as a "building block" in the grammar. As such, it would be nice to be able to mark a rule as "non-node creating". The library simpleparse supports this by creating 'unreported productions' that would translate into something like this for parsimonious:Then, any
number
node could simply be the number, and we don't get a bunch of (unneeded) nodes for each component – because the angle brackets signify that this rule should not be "reported" separately.I suppose this could either be implemented while parsing the grammar – replacing any reference to such a rule with simply its contents (at a preprocessing stage), or as part of the parsing of the text...
The text was updated successfully, but these errors were encountered: