custom error handling / error recovery, i.e. to prevent the parser to stop at the first error
creating tokens, if you don't want to do that externally
setting custom variables, especially for state tracking. e.g. in C++ you could save whether you are inside a private, protected oder public section. then you could save this information inside each node of the class elements.