kjosib / booze-tools

Booze Tools will become the complete programming-language development workbench, all written in Python 3.9 (for now).
MIT License
14 stars 1 forks source link

Debugging Parsers (and things parsed) #43

Open kjosib opened 1 year ago

kjosib commented 1 year ago

Various things would be easier if there were a consistent format for diagnostic data passed into all the ParseErrorListener methods -- and also things like exception_parsing, exception_scanning and on_stuck. Have convenient methods to inspect the parse stack, scan state, and next-token, and the human-readable action/constructor name (as applicable) without acrobatics.

parse_action_bindings calls driver.exception_parsing(ex, cid, args). This should really move into shift_reduce.parse.reduce_by_rule, and onto ParseErrorListener. Maybe default behavior is to print diagnostic data on stderr before re-raising the original exception.