Question: Q1 - Ambiguous Grammar 1. S - ABCD 2. A-> ae | af | ag | ah a) Prove that the above context free grammar

Q1 - Ambiguous Grammar 1. S - ABCD 2. A-> ae | af | ag | ah a) Prove that the above context free grammar is ambiguous. b) Convert the grammar to a non-ambiguous grammar, show the new production rules of the new grammar. (Hint: take as many left factors as you can) c) Show the parsing table of stack operations of syntax analyzer for the non-ambiguous grammar of part (b). (Hint: the table shows the stack actions associated with all possible tokens at top of the stack and all possible terminal tokens to be parsed). Starting with the stack at the initial phase (S$], how parsing will progress to parse the string: (afhg#). Show all steps of parsing. Will parsing succeed? d) Q1 - Ambiguous Grammar 1. S - ABCD 2. A-> ae | af | ag | ah a) Prove that the above context free grammar is ambiguous. b) Convert the grammar to a non-ambiguous grammar, show the new production rules of the new grammar. (Hint: take as many left factors as you can) c) Show the parsing table of stack operations of syntax analyzer for the non-ambiguous grammar of part (b). (Hint: the table shows the stack actions associated with all possible tokens at top of the stack and all possible terminal tokens to be parsed). Starting with the stack at the initial phase (S$], how parsing will progress to parse the string: (afhg#). Show all steps of parsing. Will parsing succeed? d)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
