[antlr-interest] Duplicate nodes on a parse tree?

Terence Parr parrt at cs.usfca.edu
Wed Mar 14 12:53:11 PDT 2007


THat is a result of backtracking.  If parser.backtracking>0 don't add  
a node.
Default is to show during debugging.
Ter
On Feb 28, 2007, at 2:51 PM, Vadim Tropashko wrote:

> I'm leveraging debugger parse tree generation as
> described in
> http://www.antlr.org/wiki/pages/viewpage.action?pageId=1760
>
> Everything works as advertised, although I'm getting
> duplicate nodes. For example given the rule:
>
> boolean_primary options { backtrack=true; }
> :         sim_expr
> |
>  member_predicate
> |                          comparison_predicate
> ;
>
> I'm getting the tree branch like this
>
> boolean_primary
>     sim_expr
>         ....
>     sim_expr
>         ....
>
> Is the duplicate "sim_expr" branch occurrence due to
> backtracking?  Then what would be the right way to
> filter out those ghost nodes?
>
>
>
> ______________________________________________________________________ 
> ______________
> 8:00? 8:25? 8:40? Find a flick in no time
> with the Yahoo! Search movie showtime shortcut.
> http://tools.search.yahoo.com/shortcuts/#news



More information about the antlr-interest mailing list