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

Re-examine assumption that we need bottom-up parsing #1

Closed
AsturaPhoenix opened this issue Jul 28, 2016 · 1 comment
Closed

Re-examine assumption that we need bottom-up parsing #1

AsturaPhoenix opened this issue Jul 28, 2016 · 1 comment
Assignees

Comments

@AsturaPhoenix
Copy link
Owner

AsturaPhoenix commented Jul 28, 2016

Current assertion:

It is less straightforward to get top-down parsing to handle rewrite rules since top-down parsers are guided by a map of productions to patterns. In the case of rewrite rules, these productions can potentially be expansions or dynamic, which would need to be matched against the pending production in a top-down parse. This is doable, but involves a potential inverse function/production analysis, or may turn into a hybrid top-down-bottom-up parse.

Actually, I think a rewrite can be performed top-down by backtracking to where the rewrite began. This may greatly simplify the parse algorithm if we can get it to reconsider all relevant decision branches when it does such a backtrack, and if we can get it to work with retroactive rules.

Also: keep reading http://dotat.at/tmp/gll.pdf

@AsturaPhoenix AsturaPhoenix self-assigned this Jul 28, 2016
@AsturaPhoenix
Copy link
Owner Author

After thinking further, the original point remains valid. Being able to backtrack to handle a rewrite presupposes that the parser was able to recognize the rewrite rule at all, which in general is not the case without the aforementioned inverse function/production analysis, or equivalently manual language design that explicitly includes rewrite possibilities in top-down recognition. I don't think this is acceptable; it is still much easier to do the parse bottom-up and introduce stack-like semantics on top of that algorithm.

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

No branches or pull requests

1 participant