Hi,

There is something fundamental and important that I have not understood with
ANTLR grammars.

If I need to parse something like...

        int test;
        strig another; 
        int variable;
        string here;

You notice there is a typing error on the second line ('strig' instead of
'string').

How do I make a grammar that will not stop parsing but, continues after an
error??

Below is an example how I CANNOT make it work the right way (created AST
contains only 'int test ;')..

grammar List;

options {
        language = CSharp3;
        TokenLabelType = CommonToken;
        output=AST;
        ASTLabelType = CommonTree; 
}

@lexer::namespace{ConsoleApplication4}
@parser::namespace{ConsoleApplication4}


public r 
        : variables*
        ;

variables
        : type ID ';'
        ;

type
        : 'int'
        | 'string'
        ;

ID : 'a'..'z' + ;

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


Many thanks for your time and help,

Mari



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