I am trying to learn antlr. If I am expecting these kind of sentences (first word is uppercase, rest can be multiple alphanumeric mixed case words):
HELLO world foo THIS ThaT FOO HELLO THAT BANANA BeRRY 99 APPLE juice80
If I define rules as:
grammar Hello; r: UC MC UC: [A-Z]+ ; //only uppercase MC: [A-Z|a-z|0-9]+ ; //uppercase, lowercase, and numbers or anycombination of these
For the input HELLO WORLD, I get the error:
mismatched input WORLD expecting MC
I see that the two rules conflict when it comes to the uppercase characters. How do I handle such cases?