Hello, I was wondering what people thought about the idea of asserting the success of the application of a production rule (fact) into the cache (fact database) as a means of local error detection and recovery.
By local I mean in such cases where we've past a point where a failure implies a parse error. Recovery is local and would hopefully allow the parser to continue; however, the behavior of the parser when it continues might be strange. The key idea is that we want to tell the parser to continue, but that if we simply recoded a successful application of a production rule (i.e. matching the empty string) then there would be no indication of a parse error, and so a marker of sorts is needed. Consider the following simplistic example for matching nested balanced parentheses: Expr : '(' ExprTail : '' ; ExprTail : Expr ')' : Assert(UnmatchedParenError) ; An assert statement is equivalent to matching the empty string with the side-effect of adding an entry to the cache marking the successful application of whatever is being asserted at the current input position. Best Regards, Peter Goodman, http://ioreader.com 70 Winston Circle, Montreal, Quebec H9S 4X6 _______________________________________________ PEG mailing list PEG@lists.csail.mit.edu https://lists.csail.mit.edu/mailman/listinfo/peg