So, I have this grammar (below), and I need to build a parsing table. I need to make this suitable for a predictive analyzer. I know that the first is to make it unambiguous, but for me it is already unambiguous (since I can’t find a line for which I can draw 2 different parsing trees). Secondly, I need it to remain factored. I put my hypothesis below the original grammar, I feel like I missed something, can someone point out that I missed something.
S -> m G | m K p
G -> n G | n
K -> q K r | m n
My suggestion:
S -> m A
A -> G | K p
G -> n G'
G' -> n G' | emptyString
K -> q K r | m n
Bobby source
share