I am attempting to use Antlr to tokenize and classify the tokens of an input stream. Does anyone know of a way to generate only a Lexer from Antlr using a grammar with only Lexer rules?
2 Answers
1
votes
0
votes
You can basically generate a parser and extend the listener class then inside every exitMethod() push the tokens into a stack.
You can't generate only a lexer. If you are not familiar with ANTLR 4 grammar or the steps required to generate a parser, I advise you to spend 10 mins in reading this book "The definitive of ANTLR 4".