+1 vote
71 views

I have one doubt regarding getting viable prefixes for a grammar.

Suppose I am given a grammar G which is told to be LR(0).I have observed, if I draw LR(0) DFA for it, and see if there is a path labeled $\gamma$ from initial state to some state of DFA, then $\gamma$ is a viable prefix.Is my understanding correct?

Sometimes, it is not told what the grammar is.?Like is it LR(0) or SLR(1) or LALR(1) or LR(1) or not LR(1).

Like below

https://gateoverflow.in/29094/find-viable-prefix

In such cases, how Do i start making DFA? Do i first check directly for LR(1)?

I want a good process to give me viable prefix in a reasonable amount of time and accurate answer.

Pleas help.

1
2