sebastianriese / pyLR1

A pure python LR(1)/LALR(1) parser generator
7 stars 3 forks source link

Error recovery in the parser #13

Open sebastianriese opened 11 years ago

sebastianriese commented 11 years ago

Add support for error recovery in the parser. See the Dragon Book for ideas. Good error messages for parsing errors would also be very desirable.

sebastianriese commented 11 years ago

Some work done. We implement a mechanism similar to yacc/bison. The rough idea is described in the dragon book: Add an ERROR symbol, when matching an error symbol ignore unmatching tokens, add productions to reduce ERROR on certain look-aheads.

TODO: Thorough testing, useful error messages, useful error reporting mechanism (perhaps related to issue #14, perhaps we should use logging or an error sink interface to be supplied by the user)