Search code examples
parsinggrammarlr-grammar

SLR parsing conflicts with epsilon production


Consider the following grammar

S -> aPbSQ | a

Q -> tS | ε

P -> r

While constructing the DFA we can see there shall be a state which contains Items

Q -> .tS

Q -> .  (epsilon as a blank string)

since t is in follow(Q) there appears to be a shift - reduce conflict.

Can we conclude the nature of the grammar isn't SLR(1) ?


Solution

  • (Please ignore my incorrect previous answer.)

    Yes, the fact that you have a shift/reduce conflict in this configuring set is sufficient to show that this grammar isn't SLR(1).