Open cowboy8625 opened 2 weeks ago
Compile time errors seem straight forward in my mind.
[ ] Add a new variant to the Expr
enum in ast
called Error(Span)
.
[ ] In parser
we would need to consume any errors till the matching )
then try to start parsing again.
[ ] Accumulate all the Errors in parser then report then threw error diagnostic tool.
[ ] On the Compiler
struct we would need to add a Vec<Error>
Error would need to hold any details of the error to report. This could be done threw a enum and different variants where the variants hold a Span
.
[ ] Recovering from an errors while compiling would be skipping to the next expression.
Going to keep editing this comment as I think of things to add.
I think using a crate for displaying error message to user makes sense as this VM will stay in Rust. The best looking one is ariadne and i have past experience using it. Worth noting that there is also codespan-reporting which used by nu-shell.