Moving to Antlr4 might solve this issue. Note that most scripts of this size will bump up against classfile limitations.
The usual workaround: compile your script with CPython and use the PBCVM - http://bugs.jython.org/issue527524