TheDan64 / limonite

[WIP] Compiler for the Limonite programming language.
Apache License 2.0
14 stars 3 forks source link

Need consistent error handling and formatting #33

Open TheDan64 opened 9 years ago

TheDan64 commented 9 years ago

Currently lexer error messages are passed up to the parser, which is probably fine. But I think the parser and code generator should have a format and possibly a supporting format function decided for how to format errors (and eventually warnings). We currently have like 2-3 different functions, I think, all of which are for different formatting?

Also, there should be discussion on whether or not we're handling errors the right way. Current MO for both the parser and code generator is to just print the error right away and return None. Iirc, the None will just be propagated back to the top level and disregarded. I personally like how this works, but I'm not sure if we should be doing it this way.

The alternative, I suppose, would be to use Rust's Result as intended for error handling, to propagate the error message to the top level and print it there.

I'm kinda more in favor of keeping it as is at the moment, but I'd also like for us to consider any benefits there might be by switching to the Rust practice/standard of using Result for error handling.

TheDan64 commented 8 years ago

Currently being worked on in the better error handling branch.

Here is a WIP checklist for things that this issue covers. Checked items are currently covered by this branch. Not all items may make it into the initial PR so that we can have the basic building blocks in place.

TheDan64 commented 6 years ago

The failure crate seems to be the standard for error handling today