grammar Ambiguious001;


string      : string Plus string

            | string Minus string

            | Digit

            ;



Digit       : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ;

Minus       : '-' ;

Plus        : '+' ;



Remove All Left Recursion or Remove Left Recursion produces

grammar Ambiguious001;



string      : (Digit) (Plus string | Minus string)*

            ;



Digit       : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ;

Minus       : '-' ;

Plus        : '+' ;



However

grammar Ambiguious001;



// Parser



string      : string Plus string

            | string Minus string

            | Digit

            ;



// Lexer



Digit       : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ;

Minus       : '-' ;

Plus        : '+' ;



Remove All Left Recursion or Remove Left Recursion produces



grammar Ambiguious001;



// Parser



string      : (Digit

            ;) (Plus string | Minus string)*



// Lexer



Digit       : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ;

Minus       : '-' ;

Plus        : '+' ;

  It's the first time I have ever had an error wink at me.

Eric

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

Reply via email to