# Answer on Other Math Question 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

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

Expert's answer

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.

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 orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment