Michaeljohn Clement wrote: >I have done something similar, by basically memoizing everything you try >in a packrat-style parser and then just dumping the whole table. As you >point out, this works best on small inputs. > >I've experimented with querying this full table in various ways, ...
At some point I had to decide between real-time printing and saving the full output for later analysis. Real-time was expedient and sufficient for me at the time, but post-parse analysis of the full table has some definite advantages and is fertile ground for further work. >I think generating acceptable error messages from a parser alone is an >interesting hard problem. Terence Parr wrote: >Has anyone thought of parsing backwards from the end towards the >detected error location? If you parse forwards and backwards you might >be able to zoom in on a problem area. Of course if there are lots of >errors following the first one, it won't help you too much. It's sort >of what a human does though, isn't it? We look down a few tokens and >work our way back up to see if we can make sense of things. > >The other thing I wondered about. Can we launch a whole bunch of >threads using multiple core to sniff the input to improve error >analysis? Maybe we launch parsers at multiple points in the input >stream and then use the interpretation that yields the fewest errors. > >Just random thoughts. Let's use those cores, man! Just some ruminations here. Maybe Im being too pessimistic here but I really dont hold out a lot of hope for automated debugging of grammars. An algorithm writes the parser but a human writes the grammar. There is no algorithm I know of that can take a spoken-word specification and generate a grammar. And fixing a defective grammar is more of the same type of human activity. Until algorithms can generate grammars I dont think algorithms will be more than modestly helpful in finding and analyzing errors and printing cogent error messages. This reasoning is not original to me. It is essentially the same argument as Frederick P. Brooks, Jr.s (The Mythical Man-Month) famous and controversial No silver bullet hypothesis. I think grammar debugging is and will remain for some time to be art of instinct. It is a knack that Im sure everyone reading this mailing list has and can use to sniff out the problems from an assisted examination of the trace. Im sure there is room for improvement here, eg. post-parse analysis, but I dont think meaningful, automated error messages is too promising. I dont see a parser anytime soon printing out a message like term = A/B: sorry, prioritized-choice rule selected A but you really wanted B. Thanks, Lowell Thomas low...@coasttocoastresearch.com www.coasttocoastresearch.com _______________________________________________ PEG mailing list PEG@lists.csail.mit.edu https://lists.csail.mit.edu/mailman/listinfo/peg