Skip to content

Parser reductions - #4475

Merged
kddnewton merged 63 commits into
mainfrom
parser-reductions
Nov 24, 2026
Merged

kddnewton merged 63 commits into
mainfrom
parser-reductions

Conversation

@kddnewton

@kddnewton kddnewton commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

When a node is returned from a parsing function, instead of returning the raw node we're going to wrap it in a struct with an enum telling us what kind of reduction produced that node. That allows us to figure out when we need to break out of the pratt loop without having to look at the node itself and guess. This also lets us model the stmts/expr/arg split in parse.y much more faithfully.

Fixes #4463
Fixes #4464
Fixes #4465
Fixes #4466
Fixes #4467
Fixes #4468
Fixes #4469
Fixes #4470
Fixes #4471
Fixes #4472
Fixes #4473
Fixes #4474

Closes #4380

This wraps the node returned by parse_expression* to contains just
the node itself at the moment. This is to set up being able to
track which kind of reduction was produced, in order to properly
exit the pratt loop on stmt or expr reductions that should not be
followed by things like modifiers.
When parsing a yield, if it has no parentheses and it has
arguments then it counts as a command, which is higher up in the
grammar. It cannot be combined with modifiers, so we need to exit
the pratt loop.
stevenjohnstone added a commit to stevenjohnstone/prism-fuzzer that referenced this pull request Nov 24, 2026
@kddnewton
kddnewton merged commit d4b9e07 into main Nov 24, 2026
122 checks passed
@kddnewton
kddnewton deleted the parser-reductions branch November 24, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment