Skip to content
This repository has been archived by the owner on Nov 30, 2020. It is now read-only.

Better error reporting #12

Open
4 tasks
toroidal-code opened this issue Sep 16, 2014 · 0 comments
Open
4 tasks

Better error reporting #12

toroidal-code opened this issue Sep 16, 2014 · 0 comments

Comments

@toroidal-code
Copy link
Contributor

This issue corresponds to an item on the current To-Do list in README.md.

From my experiences, there's going to be quite a bit going into this:

  • A location type, that contains information including, but not limited to:
    1. Current file
    2. Beginning of the location
    3. End of the location
  • An error type. The OCaml compiler uses exception, but this has the problem that only one error can be raised per parse. Keeping track of multiple errors and discarding malformed expressions (or even adding a node to the AST that notes an error) is more ideal.
  • Error recovery (some way of sanely handling errors, and continuing to lex/parse). In Kiln, I'm doing this via a Queue that contain errors in the Lexer/Parser modules , and ensuring that they are empty before proceeding to the next stage of compilation.
  • A way to pretty print errors. A suggested way to do this is with an open sum type in an Errors module. This leads to being able to handle both specific errors and more generic errors in same match statement

The OCaml compiler is a fantastic example for some of these things.
The work I'm doing in Kiln is also relevant.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant