[antlr-interest] DMQL Grammar - ANTLR Eats Characters

Terence Parr parrt at cs.usfca.edu
Fri Mar 20 12:58:42 PDT 2009


Well, come to think of it, I have not tried it a while but:

A : ('(' A ')')=> '(' A ')'
    | '(' A* ')'
   ;

should work.  Yep, seems to:

             if ( (LA2_0=='(') ) {
                 int LA2_1 = input.LA(2);

                 if ( (synpred1_T()) ) {
                     alt2=1;
                 }
                 else if ( (true) ) {
                     alt2=2;
                 }


Ter
On Mar 20, 2009, at 12:55 PM, Gavin Lambert wrote:

> At 07:31 21/03/2009, Terence Parr wrote:
>> Hi. ANTLR generates lexer's, parsers, tree parsers with the same
>
>> code generator and all of those derive from a single base class.
>
>> all three can backtrack :) in the case of the lexer, though,
>> it's not the kind of backtracking you see in lex.
>
> Doesn't backtracking require support from the code-generation
> templates, though?  It was my impression that the templates for
> the lexer don't contain the necessary pieces to actually do the
> backtracking, even though the base class does.
>
> (Besides which, it never seems to want to backtrack all the way to
> mTOKENS.)
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list