Question 5556 – Compiler-Design
May 17, 2024Question 5642 – Compiler-Design
May 17, 2024Compiler-Design
Question 255
|
Given a grammar : S1 → Sc, S → SA | A, A → aSb | ab, there is a rightmost derivation
S1 ⇒ Sc ⇒ SAC ⇒ SaSbc
Thus, SaSbc is a right sentential form, and its handle is
S1 ⇒ Sc ⇒ SAC ⇒ SaSbc
Thus, SaSbc is a right sentential form, and its handle is
SaS
|
|
bc
|
|
Sbc
|
|
aSb
|
Question 255 Explanation:
A “handle” of a string is a substring that matches the RHS of a production and whose reduction to the non-terminal (on the LHS of the production) represents one step along the reverse of a rightmost derivation toward reducing to the start symbol.
And in above question aSb is a handle because it’s reduction to the LHS of production A → aSb represents one step along the reverse of a rightmost derivation toward reducing to the start symbol.
And in above question aSb is a handle because it’s reduction to the LHS of production A → aSb represents one step along the reverse of a rightmost derivation toward reducing to the start symbol.
Correct Answer: D
Question 255 Explanation:
A “handle” of a string is a substring that matches the RHS of a production and whose reduction to the non-terminal (on the LHS of the production) represents one step along the reverse of a rightmost derivation toward reducing to the start symbol.
And in above question aSb is a handle because it’s reduction to the LHS of production A → aSb represents one step along the reverse of a rightmost derivation toward reducing to the start symbol.
And in above question aSb is a handle because it’s reduction to the LHS of production A → aSb represents one step along the reverse of a rightmost derivation toward reducing to the start symbol.
Subscribe
Login
0 Comments