added * Tree parser error handling should skip subtrees not nodes; these are programming errors not input errors. The flat stream makes it hard to resync.
Ter On Mar 24, 2011, at 2:07 AM, Iztok Kavkler wrote: >> Howdy, I'm going to start augmenting ANTLR v3 significantly to create v4. >> The goal is backward compatibility; any new functionality, of course, will >> require altering or augmenting your grammars to take advantage of it. Here >> is my potential list of updates: >> >> http://www.antlr.org/wiki/display/ANTLR4/ANTLR+v4+Wish+list >> >> Anything to add or comment on? >> >> Ter >> >> List: http://www.antlr.org/mailman/listinfo/antlr-interest >> Unsubscribe: >> http://www.antlr.org/mailman/options/antlr-interest/your-email-address > > A new error recovery mode for tree parsing: > When parsing ASTs, the ordinary error recovery strategies based on token > deletion/insertion are completely useless, because there are no man-made > syntax errors. In my experience, what you really want to do is the > following: assume that you have an error handler attached to some rule > and an error happens somewhere in the subtree of the node parsed by that > rule. When the handler catches an error, the parser must skip the > remainder of that subtree, otherwise the parser position is not > consistent with the grammar position anymore. In AST implementations > that are based on pointers between nodes this happens automatically, but > Antlr's representation as a flat list of nodes with UP and DOWN tokens > makes it requires some work - the parser has to keep track of the > current node's depth and skip the appropriate number of UP nodes > whenever an error is caught. > > Iztok > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
