I am having problems with my Antlr grammar. I\'m trying to write a parser rule for \'typedident\' which can accept the following inputs:
\'int a\' or \'char a\'
'int a' isn't accepted while 'int ab' is accepted. ... My guess why this works is because ALPH and DIGIT were overriding ...
Yes, it appears ALPH was defined before the IDENT rule, in which case single letters were tokenized as ALPH tokens. If IDENT was defined before ALPH, it should all go okay (in your case).
To summarize how ANTLR's lexer rules work:
You must realize that the lexer does not produce tokens based on what the parser (at that time) needs. The lexer operates independently from the parser.