-
Notifications
You must be signed in to change notification settings - Fork 9
Error recovery when handling bad inputs #3
Copy link
Copy link
Open
Labels
forwarded-to-js-devsThis report has been forwarded to Jane Street's internal review system.This report has been forwarded to Jane Street's internal review system.not-clear-what-next-step-isThis report is kept open as a reminder, but it is not clear what should happen next.This report is kept open as a reminder, but it is not clear what should happen next.
Metadata
Metadata
Assignees
Labels
forwarded-to-js-devsThis report has been forwarded to Jane Street's internal review system.This report has been forwarded to Jane Street's internal review system.not-clear-what-next-step-isThis report is kept open as a reminder, but it is not clear what should happen next.This report is kept open as a reminder, but it is not clear what should happen next.
Hi there,
Thanks for this cool library. I'm using it to parse programs written in a lisp-like language (the stack goes like this: read sexps → parse into an AST → resolve names → typecheck).
I've added error recovery mechanisms to all phases except the first one. This way I can report multiple input errors instead of stopping at the first one, but only as long as the input is well-parenthesized.
Now I'd like to make the sexp-reading phase a bit more robust. I've already changed to an eager parser, which gives me a nice way to parse, resolve, and typecheck all top-level sexps until the first parse error. I'd like to do more, by handling the following cases:
a ) bshould parse likea b(and report an error, of course).((a bshould parse like((a b))(a "xyz" b)I've got the first one to work by skipping characters every time I get a parse error, but number 2 and 3 seem tricky to do without access to the contents of the parser's stack. A I going about this the right way? Is there an easier approach that I missed?
Thanks!