-
Notifications
You must be signed in to change notification settings - Fork 42
Description
I've been wondering what it would take to improve the debugging experience for combinators in generalm but here are some specific ideas (TODO: breakdown based on usecases; which part of my code is failing? what data does it see?):
-
parse errors show where they failed and what symbol they were expecting, this is somewhat redundant with the "line number:character" location data, but it would still be helpful to show the next few symbols the parser is failing on. Improve debugging: peek show next data in errors #46
-
a .debug() method which can be added inline wherever you need to see the output of the previous parser method / the input to the next parser method Inline (explicit) and implicit tracing #49
-
It would be good to also have something for things like
seq(a, seq(b, c))where you can insert a debug on the left of b, to see what input it's getting. I.e. you can't use a method at the beginning of a sequence of parsers so it needs to be a function different from .debug() Inline (explicit) and implicit tracing #49 -
It would also be cool if you didn't need to annotate with .debug wherever you wanted to debug something, but could get the parser to give information about the relevant things without changing your code. The only way to do this that I've been able to think of is to write an extra wrapper for every function? And for filtering, to be able to say "return trace information between characters x and y"'. Inline (explicit) and implicit tracing #49
-
I haven't found trying to use the debugger particularly illuminating (IIRC?) because it never jumps back into user code where I can see which part of my grammar is causing problems. It would be cool if there were ways to make using a debugger more ergonomic but I have no ideas for that...
-
It would be helpful if
.bindcould handle ParseError (stream, index) properly and return the appropriate error information when a ParseError gets passed up to the larger context. Recompute line number for ParseError passed up from .bind #47