Consider the following grammar:
Stmts -> Stmt | Stmts;Stmt Stmt -> Var =E Var ->id[E] | id E-> id | (E)
in accepting state we get
S' -> stmts . stmts -> stmts . ;stmt
isn't it a conflict ?
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.Sign up to join this community
I don't think there is a real conflict here.
It does look like a shift/reduce conflict but if you are at the end of the input there is no ";" symbol that can be shifted so only reduction to S' applies.
There are ways you can deal with things that look like conflicts near the accepting state.
One is to have a pseudo token for end of input. This distinguishes a parse where you consume all the input from one where you have unconsumed tokens (garbage) remaining.
If you have a choice between which rules to apply you can have a preference for a reduction to the start symbol and thus to accepting rather than applying further rules.