I'm developing my own compiler, and I have a problem with error recovery design in panic mode for java grammar.
I thought about multiple solutions, but the real question:
How I could do that with bison c++?
I did that:
package 2
import java.lang.*;
error must consume to first semi colon and this run correctly with rule
package_rule: PACKAGE error ';'
but if I wrote this code:
package 2
import java.lang.*
class y { void method() { int m }
}
what I need from parser like a standard compiler, to report errors:
identifier expected at line of package. missing ';' report one for package at import instruction line. mssing ';' at int m line.
I mean I need after package error to consume token until the first semicolon or stop when find class or interface declaration at last line before declare them ! and report any other errors found after line:
int m // missing ';'
please please help me, in my mind multiple solutions, but how do that with bison c++ for java grammar?