Skip to content

Parser fails in unexpected way #663

Answered by zesterer
purpl3F0x asked this question in Q&A
Discussion options

You must be logged in to vote

It is intended behaviour, although admittedly not always desirable behaviour. Chumsky will prefer branches that result in fewer errors, but the exponential explosion of possible parse paths means that the parser may overly eagerly commit to a recovery pattern, missing an alternative valid parse. It's important to have error recovery occur as high up the stack as you reasonably can, and to not be overly general, so that the parser gets the opportunity to try all valid approaches to parsing the syntax before falling back to recovery.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@purpl3F0x
Comment options

Comment options

You must be logged in to vote
3 replies
@purpl3F0x
Comment options

@zesterer
Comment options

Answer selected by purpl3F0x
@purpl3F0x
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants