Question

True or False If a non-terminal symbol appears at the end of the right-hand side of...

True or False

  1. If a non-terminal symbol appears at the end of the right-hand side of a rule, its Follow set contains the entire Follow set of the symbol on the left-hand-side of the rule.
  2. If a grammar has no Nullable non-terminals, the Follow sets can be ignored when computing the predict table.
  3. If A → BaBa is a rule and First(B) = {a}, then Predict(A,a) should contain A → BaBa.
  4. If no cell of the predict table for a grammar has more than k rules, then the grammar is LL(k).
  5. Left-factoring a non-LL(1) grammar will always produce an LL(1) grammar

Homework Answers

Answer #1

(A) If a non- terminal symbol appears at the end of the right hand side of a rule , its Follow set contains the entire Follow set of the symbol on the left hand side of the rule:- True;

Because when we have to find Follow of variable from a right hand side then it contains whole Follow set of the left hand side of that rule.

A --> bB

here Follow(B)=Follow of (A)

(B) If a grammar has no Nullable non-terminals, the Follow sets can be ignored when computing the predict table:--- True

This is true because while computing the predict table we ignore follow set of non nullable variable . in case of nullable variable we cant ignore the follow set while computing the predict table.

(C) If A → BaBa is a rule and First(B) = {a}, then Predict(A,a) should contain A → BaBa:-- True

Yes this is True because here is the no chance of conflict .

(D) If no cell of the predict table for a grammar has more than k rules, then the grammar is LL(k) :-- False

Every Grammar is not feasible for LL(1) parsing table It may be possible that one cell may contain more than one production. because when we get more than one entries it means here conflict occurs and this is not LL(1) .

(E) Left-factoring a non-LL(1) grammar will always produce an LL(1) grammar :-- False

There may or may not be conflict after left factoring , Factoring is nothing but grammar transformation technique. After left factoring, Grammar becomes Deterministic but after left factoring there may or may not be conflicts. So if conflict occurs then this will not produce LL(1) grammar otherwise it will .

If this answer helped you, please upvote . For any query , please comment.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT