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

Evaluate parser-level instead of rule-level macro expansion #118

Open
sirthias opened this issue Dec 5, 2014 · 0 comments
Open

Evaluate parser-level instead of rule-level macro expansion #118

sirthias opened this issue Dec 5, 2014 · 0 comments
Labels

Comments

@sirthias
Copy link
Owner

sirthias commented Dec 5, 2014

Currently we employ a per-rule macro expansion approach which has the benefit of being simpler and more focused than the alternative of defining a complete (or partial) parser in a single macro, similar to what is done in https://github.com/begeric/FastParsers.
It also has the benefit that the user directly controls all aspects of the parser class (inheritance, additional members, etc.) without a macro potentially getting in the way.

The disadvantage is that a per-rule macro expansion has only local knowledge and cannot "look into" other rule definitions, which prohibits catching things like #117 or performing cross-rule optimizations.

We need to evaluate whether parser-level macro expansion has a positive cost/benefit when compared with the current approach.

Also, it might be possible to publish the inner rule structure to the outside even with the per-rule macro approach by moving to structural types as rule macro results, thus potentially combining the benefits of both approaches.

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

No branches or pull requests

1 participant