-
Notifications
You must be signed in to change notification settings - Fork 23
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
Deforested tree construction possible? #37
Comments
Owl does use an event-based approach, though it's a little strange because (as I mentioned in the other issue), they're generated in a backward pass, with the "end" event before the "begin". I guess it would be preordered, but in reverse? I'm curious what changes to owl you're looking to see here? Are you planning to use it for something where incremental parsing is important? Or do you want to understand how it works so you can build something like it (which to be clear I would be happy to help with however I can)? |
I'm currently researching if it would make sense to use visibly pushdown parsers for parsing the lexical structure of programming languages instead of immediately going to context free parsers if the lexical structure is not regular.
Oh, that's interesting. If my observations are correct, then the following parsing methods result in the following tree event orders: LR (bottom up left to right): postorder I have an LR-style parser generator and I would like to maintain a single list of events for lexical and syntactical ASTs. It seems that if owl supports RR-style events, that this wouldn't be compatible with LR-style events. However, I might have to implement an RR-style mode of operation for my parser generator because this makes it much more efficient to traverse children from left to right. In which case it would become compatible with your approach.
Your RR-style approach might in fact be superior in practice, so, none, but I'm not entirely sure yet. I'll have to think some more. Thank you for your help! |
Hello @ianh,
Here you wrote:
This reminds me a lot of GLR parsing. One thing that has made GLR parsing much simpler for me is not to construct an explicit tree, but to maintain a postordered list of tree events (see "Post-Order Parser Output" for a brief explanation).
A postordered list of events is inherent to LR parsing. A preordered list of events is inherent to LL parsing. I was wondering, how feasible would it be to support generating such a list of events with the approach that owl takes? That is, would it be possible to compress your construction actions into just 2 categories of events:
begin_subtree_of_type_x
andend_subtree_of_type_x
?If so, do you think that your approach would support a preordered or a postordered list of events?
With such a list of events, updating subtrees could be made very simple with a Piece table, which I'm currently investigating in a different project.
The text was updated successfully, but these errors were encountered: