简体   繁体   中英

Bottom - Up SLR(1) Conflict / Reduce when both applies

If I have a situation where a state in the DFA have shift/reduce conflict, where both shift and reduce applies, let the next symbol be "t" and we have the following rules

X -> F.

Y -> F.tG

and t belongs the follow of X What should I do in this case? I know by definition that's not an SLR(1) Grammar but according to the algorithm shown https://imgur.com/a/yxy9L48 , what should the algorithm do? Should it report an Error?

The algorithm says we report an error if neither (shift or reduce) applies, but what happens if both apply?

You should have detected this error when you attempted to construct the parser. The SLR parser generation algorithm must fail if there is a conflict.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM