Skip to content

Harden the parser #4

Description

@LytixDev

Right now the parser is likely to just panic on trying to parsing an invalid input. Right now I am more interested in diving straight into the back-end of the compiler and will put this on hold. Here are some general points which should be talked at some point:

  1. Improved error handling. This means reporting errors better and attempting to detect them better. I have been a bit lazy and just reported PET_CUSTOME parse errors quite a few places in the parser. Error messages should be crafted with care and include as much detail as possible, especially about the context of the error. Exactly where it failed, perhaps why it failed?, and also what the parser would accept at this stage.

  2. Improved error recovery. Once we hit an error we should try to recover and continue parsing. This is a big topic in itself. For a handcrafted parser like this, I have no clue what strategies could be employed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions