I'm using .cup file to generate parser based on specific derivation rules.
After every reduce, I want to call a function, Is it possible to define it anywhere in the .cup file, so that it will be injected into the generated code after each reduce?
I'm using .cup file to generate parser based on specific derivation rules.
After every reduce, I want to call a function, Is it possible to define it anywhere in the .cup file, so that it will be injected into the generated code after each reduce?
Apparently so, if you are using the version of Java CUP maintained by Jochen Hoenecke on github. Quoting the manual (from that version, end of section 2.2):
According to the change log, the feature was added in 2019.