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

Limited register rollback #8

Open
j-mie6 opened this issue Jan 8, 2021 · 0 comments
Open

Limited register rollback #8

j-mie6 opened this issue Jan 8, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@j-mie6
Copy link
Owner

j-mie6 commented Jan 8, 2021

While rollback allows the user to roll state back within a local computation if it failed, it only works if the parser in question does not consume input. There is no way to tightly rollback the state from the branch except for further up the parser where the input is rolled back. This isn't a disaster but is somewhat annoying.

A combinator like onFail :: Parser a -> Parser () -> Parser a which unconditionally executes a pure parser on the failure of some other parser would allow users to perform stateful operations after a parser has failed. This wouldn't require any new instructions, but would require a new AST node to be introduced.

Using this it is possible to make local completely rollback local modifications with the local combinator

@j-mie6 j-mie6 added the enhancement New feature or request label Jul 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant