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

Refactor code to hide parser internals #12

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

hardbyte
Copy link
Contributor

@hardbyte hardbyte commented Aug 4, 2023

Small refactor in preparation for potentially switching the parser from lalrpop to chumsky as discussed in #2 (comment)

The previous implementation exposed the 'ExpressionParser' from lalrpop directly which I've just replaced with a parse function.

I assume it is worth improving the error handling once the switch is complete.

The code has been refactored to provide better error handling when parsing input. The previous implementation used the 'ExpressionParser' class directly. This has been replaced with a 'parse' function, which makes it easier to handle errors and provides cleaner code. Additionally, a custom 'ParseError' struct and 'Display' trait have been implemented.
Copy link
Owner

@clarkmcc clarkmcc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good stepping stone to abstracting the parser. Though I agree we'll want to improve error handling as well as remove print statements when the time comes. In any case, lgtm!

@clarkmcc clarkmcc merged commit 6f72cd6 into clarkmcc:master Aug 4, 2023
1 check passed
@hardbyte hardbyte deleted the feature/parser-abstraction branch August 7, 2023 02:17
@hardbyte hardbyte mentioned this pull request Aug 7, 2023
15 tasks
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

Successfully merging this pull request may close these issues.

None yet

2 participants