I think I am missing something fundamental about backtracking. The grammar
below won't parse input such as

a=b.
c=d;

... even though I would expect it to backtrack after realizing that a=b.c
leads to a dead-end. What am I missing?

Thanks!

PS: I am not looking for refactoring options, I have the issue in a complex
grammar that can't easily be refactored.

=====================================
grammar Test;

options {
        output=AST;
        backtrack=true;
}

program
        : statement* EOF
        ;
        
statement
        :       ID '=' expr
        |       sep
        ;

expr    :       ID suffix;

suffix  :       ( '.' expr )*
        ;

sep     :       ';' | '.';

// LEXER
// ==========================================

ID
        :       ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
        ;

        
WS  :   ( ' '
        | '\t'
        | '\r'
        | '\n'
        ) {$channel=HIDDEN;}
    ;


--
View this message in context: 
http://antlr.1301665.n2.nabble.com/Confused-about-backtracking-tp7033712p7033712.html
Sent from the ANTLR mailing list archive at Nabble.com.

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 il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to