Consider the grammar G1 that is shown below: G1: * ::= + | ::= *
Posted: Mon Jun 06, 2022 4:43 pm
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?
Posted: Mon Jun 06, 2022 4:43 pm
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?
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?