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:
-
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.
-
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.
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:
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.
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.