Skip to content

Error recovery tokens #10

@djspiewak

Description

@djspiewak

This falls into the "straight-up research" category. I'm pretty sure it's possible, and maybe even natural, to implement YACC-style error recovery using the derivative parsing algorithm. I think this falls out relatively naturally both due to the combinator-structure of the parse trail, and because derivative parsing (by definition) always parses to the end of the stream even when errors are hit early in the parse. So something like this might be possible:

lazy val expr: Parser[Expr] = (
    ...
  | "{" ~> error(expr) <~ "}"
  | ...
)

Or something to that effect. I say this is "straight-up research" because a practical and algorithmically coherent implementation of this idea (or something better!) is very much paper-worthy.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions