-
Notifications
You must be signed in to change notification settings - Fork 15
Use a semantic actions commit-list during parsing / Partial parsing #44
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
Comments
Probably the easiest technique to implement this is to parse a first time the input without calling semantic actions or constructing the AST and to register the "good path". And to reparse it in a second pass by effectively calling the actions. |
This "path" could also be used for recording a partial state where more of the input is needed to continue. It might be less efficient? |
A version that does not record path is already implemented by |
We need benchmarks for measuring how fast is the recognizing step vs. parsing step. If it is fast enough, I propose to record the path when recognizing. It is doable by compiling the choice as follow:
During recognizing we record the corresponding index into a |
I suggest a simpler version, useful to avoid calling semantic action with side effects on a global environment, by englobing semantic actions in lambda functions. |
Currently, the semantic action are called whenever the sub-expression is parsed. It means that if the parsing fails upwards, the result of the semantic action will be dropped. This is terrible if the semantic action has side-effect. It also will avoid to copy arguments passed to rules (when it'll be implemented) and it'll probably optimize the whole parsing step since no semantic rule will be called for nothing.
The text was updated successfully, but these errors were encountered: