E -> E+T | E-T | T T -> T*F | T/F | F F -> (E) | a | b | cModify this grammar to allow an exponentiation operator, ^, so that we can write expressions like a+b^c*a. Of course, your modified grammar should be unambiguous. Give exponentiation higher precedence than the other binary operators and (unlike the other binary operators) make it associate to the right.
S -> if E then S | if E then S else S | begin S L | print E L -> end | ; S L E -> a | b | cShow that the grammar is now ambiguous.
[You may wonder how a recursive-descent parser can be written, given the ambiguity that you found in question 2. This ambiguity, known as the dangling else ambiguity, is found in many programming languages, including C and Java. However, you should see that the parser can resolve that ambiguity in a natural way that corresponds to a rule that you should have learned in your study of C or Java.]