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

Parser Refactor #627

Merged
merged 31 commits into from
Jul 5, 2023
Merged

Parser Refactor #627

merged 31 commits into from
Jul 5, 2023

Conversation

rvcas
Copy link
Member

@rvcas rvcas commented Jun 20, 2023

closes #587

@rvcas rvcas added the parsing Parser work label Jun 20, 2023
@rvcas rvcas force-pushed the rvcas/parser_refactor branch 3 times, most recently from 4e4c4d2 to b92d9f2 Compare June 28, 2023 00:17
@rvcas rvcas marked this pull request as ready for review July 4, 2023 15:19
@rvcas rvcas force-pushed the rvcas/parser_refactor branch 2 times, most recently from 5e09e20 to bd47731 Compare July 4, 2023 21:15
crates/aiken-lang/src/parser/expr/anonymous_binop.rs Outdated Show resolved Hide resolved
crates/aiken-lang/src/parser/expr/assignment.rs Outdated Show resolved Hide resolved
crates/aiken-lang/src/parser/expr/block.rs Show resolved Hide resolved
crates/aiken-lang/src/parser/expr/bytearray.rs Outdated Show resolved Hide resolved
crates/aiken-lang/src/parser/expr/if_else.rs Outdated Show resolved Hide resolved
crates/aiken-lang/src/parser/expr/if_else.rs Show resolved Hide resolved
crates/aiken-lang/src/parser/expr/mod.rs Outdated Show resolved Hide resolved
crates/aiken-lang/src/parser/expr/mod.rs Outdated Show resolved Hide resolved
crates/aiken-lang/src/parser/expr/mod.rs Outdated Show resolved Hide resolved
crates/aiken-lang/src/parser/utils.rs Outdated Show resolved Hide resolved
@KtorZ
Copy link
Member

KtorZ commented Jul 5, 2023

Nice work, that was desperately needed. It now makes me eager to go in each parser, one after the other to improve them and get some nice backtracking errors.

I've left a few comments which I don't mind addressing myself or in a pairing session. I'll be on Discord streaming, feel free to join :)

KtorZ and others added 7 commits July 5, 2023 13:57
  The 'public' util was arguably not really adding much except a layer of indirection.
  In the end, one useful parsing behavior to abstract is the idea of 'optional flag' that we use for both 'pub' and 'opaque' keywords.
Equality on a union-type is potentially dangerous as the compiler won't
complain if we add a new case that we don't cover. Reversing the
assignment by yielding a `Token` for a given `AssignmentKind`. This way
we can use a pattern-match that got us covered for future cases.
  Also moved the logic for 'int' and 'string' there though it is trivial. Yet, for bytearray, it tidies things nicely by removing them from the 'utils' module.
Alleviate a bit more the top-level expression parser. Note that we
probably need a bit more disciplined in what we export and at what level
because there doesn't seem to be much logic as for whether a parser is
private, exported to the crate only or to the wide open. I'd be in favor
of exporting everything by default.
@KtorZ KtorZ merged commit 82dc795 into main Jul 5, 2023
@KtorZ KtorZ deleted the rvcas/parser_refactor branch July 5, 2023 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parsing Parser work
Projects
Status: 🚀 Released
Development

Successfully merging this pull request may close these issues.

Parser Refactor
3 participants