program: start+;

 

start :      (let | num);

 

let    :      LET;

num    :      NUM;

 

LET    :      ('a'..'z')+;

NUM    :      ('0'..'9')+;

 

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

 

 

1) Why inside Lexer and Parser all methods are declared Private (for example
the above "program" parser rule)? If I want to use one method of my Parser I
have to change it to public inside source code, is right to do this?

 

2) Is there a way to find if CommonTokenStream find some undefined chars in
the string?

 

In the above definition I want as input only lower case letters and number,
so if I write "123 aa 5 Bc" I want to detect the error at "B", How can I do
that?

 

The language I use is C# and the above code is a little example Just to test
the ANTLR functions to take me a Global understand of the potentiality.

Tank you for the support, I'm learning ANTLR but is not too easy at the
beginning.

 

Best regards Gian


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