diff --git a/src/backends/lr.c b/src/backends/lr.c index 1ea6a39511039e4a22c298583e8bc2ec92f73850..2f7d5e48b8357bf17d14739b9682e1bd81c852af 100644 --- a/src/backends/lr.c +++ b/src/backends/lr.c @@ -314,6 +314,12 @@ bool h_lrengine_step(HLREngine *engine, const HLRAction *action) // push result (value, symbol) onto the right stack h_slist_push(right, value); h_slist_push(right, symbol); + + // this is LR, building a right-most derivation bottom-up, so no reduce can + // follow a reduce. we can also assume no conflict follows for GLR if we + // use LALR tables, because only terminal symbols (lookahead) get reduces. + const HLRAction *next = h_lr_lookup(engine->table, engine->state, symbol); + assert(next == NULL || next->type == HLR_SHIFT); } return true;