Which of the followingsentences CANNOT be derived using the grammar of Example3.
ID: 3616814 • Letter: W
Question
Which of the followingsentences CANNOT be derived using the grammar of Example3.2?
a) A = A * (B + (C * A))
b) A = A + (B + C)
c) A = C * (A * C + B)
d) A = A * (B + ( C ))
Example 3.2 Grammar
<assign> =><id> = <expr>
<id> => A|B|C
<expr> => <id> + <expr>
| <id> * <expr>
| ( <expr> )
| <id>
Explanation / Answer
a) Assign => = A = A = * A = A * A = A* () A = A * ( +) =A * (B + ()) = A * (B + ( *)) = A * (B + (C * )) = A * (B + (C *A)) Therefore (a) can be derived using the given grammar b) Assign ==> = A = + = A + () = A + ( +) = A + (B + ) = A+(B+C) Therefore (b) can also be derived from the given grammar c) assign ==> = A = * = C *() = C* ( * ) = C * (A * + ) = C * (A * C + ) = C* (A *C +B) Therefore (C) can be derived using the above grammar d) assign ==> = A = * = A *() = A * ( + ) = A * ( B + ()) =A * (B + ()) =A *(B + (C)) Therefore (D) can also be derived from the given gramamrRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.