Fix error in CFG


Here is a CFG that generates the language of basic arithmetic expressions. These expressions allow the 4 basic operations on arithmetic values a,b, and c. It implements an order of operations where multiplication and division have precedence over addition and subtraction, and all operations are left-associative. It also implements parentheses. There is an error in this CFG.

S → S*T | S/T | T T → T+V | T-V | V V → (S) | a | b | c

You should re-write this CFG to accomplish as many of the following tasks as you can: a) Fix the error in this CFG to make it work as described. b) Add an exponent operation. This operation should have a higher precedence than multiplication and division, but a lower precedence than parentheses. The exponent operator is ^. For example, a^b would be ab, or “a to the b”. Give this operation, and only this operation, right-associativity, so that a^b^c would be “a to the (b to the c)”. c) Make these expressions into equations. An equation consists of one equality operator {=,<,>} with an expression on each side of it. The equality operator should have the lowest precedence, and the equality operator should not be allowed inside parentheses.