[antlr-interest] antlr v4 wish list

Iztok Kavkler iztok.kavkler at fmf.uni-lj.si
Thu Mar 24 02:07:25 PDT 2011


> 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


More information about the antlr-interest mailing list