Is it possible to implement the classic Yacc lexer hack to differentiate between identifier names and type names in a C parser generated by ANTLR4, using a standard C grammar (like the one found on the official ANTLR4 GitHub repo) ?
It seems ad-hoc code that can be plugged in ANTLR4 lexers is quite limited. In the book "The Definitive ANTLR4 Reference", Terrence Parr says:
"A common practice that s been around forever involves sending feedback from the parser to the lexer so that the lexer can send precise tokens to the parser. [...] Unfortunately, this is not possible with ANTLR grammars because ANTLR-generated parsers often look very far ahead in the token stream to make parsing decisions. [...]"
Any way to circumvent the above, and implement that feedback loop? Or is the implementation of a C parser in ANTLR4 just impossible without resorting to crazy hacks when visiting the parse tree?