In my use case I have to parse several thousand small and independent expressions into a tree representation using a Visitor on the generated parse trees. Currently new streams, lexer and parser instances are created for each parse operation.
I assume this might not be optimal. Which object instances could be re-used in such a setup to make use of the warm-up property of ANTLR4? How about thread safety - which of these instances should be thread local? Is a reset of some kind required to re-use a lexer or parser instance?