SQLite Forum

lemon cannot shift-reduce errors
Login
My fix also appears to work on your test case. Running with just the assertion-fix has a 'Fail!' in it:

```
parser: Input 'THREE' in state 0
parser: Reduce 1 [top ::=] without external action.
parser: ... then shift 'top', go to state 1
parser: Syntax Error!
parser: Popping top
parser: Fail!
parser: Return. Stack=]
parser: Input '$' in state 0
parser: Reduce 1 [top ::=] without external action.
parser: ... then shift 'top', go to state 1
parser: Reduce 0 [start ::= top] without external action, pop back to state 0.
parser: ... then shift 'start', pending reduce -2
parser: Accept!
```

With both fixes applied:

```
parser: Input 'THREE' in state 0
parser: Reduce 1 [top ::=] without external action.
parser: ... then shift 'top', go to state 1
parser: Syntax Error!
parser: Shift 'error', pending reduce 2
parser: Reduce 2 [top ::= top error] without external action, pop back to state 0.
parser: ... then shift 'top', go to state 1
parser: Syntax Error!
parser: Discard input token THREE
parser: Return. Stack=[top]
parser: Input '$' in state 1
parser: Reduce 0 [start ::= top] without external action, pop back to state 0.
parser: ... then shift 'start', pending reduce -2
parser: Accept!
```