Answer to Question #23185 in Math for Sujata Roy

Question #23185
Consider the following grammar.
S → ( S )
S → x
Which of the following statements is (are) true?
S → ( S )
S → x
I. The grammar is ambiguous.
II. The grammar is suitable for top-down parsing.
III. The grammar is suitable for bottom-up parsing.
(A) I only (B) II only (C) III only (D) II and III only (E) I, II, and III
1
Expert's answer
2013-01-30T08:11:05-0500
It's ambiguous, because for any word we have only one wayto create it.
Example: ((((x)))){S->(S),S->(S),S->(S),S->(S),S->x}
It isn't suitable for top-down parsing, because by termsto use we must have either grammar only as A->a or only as A->ab, but not
A->aAb (a="(", b=")" ) So answer is (A), because II
doesn't suit.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS