Consider the grammar G1 that is shown below:
G1: <exp>* ::= <exp> + <mulexp>
| <mulexp>
<mulexp> ::=
<mulexp> * <rootexp> | <rootexp>
<rootexp> ::= ( <exp>
)
|
a | b | c
(3 points) Modify the above grammar by adding the
equality operator (==) with the lowest precedence of all operators
in the grammar and is left associative.
2. (5 points) With the modifications
you made to this grammar, is this grammar G1 ambiguous? Why or why
not?
Consider the grammar G1 that is shown below: G1: * ::= + | ::= *
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am