Question: Consider the switch statement in C - like languages, defined here according to this grammar: 1 . P - > Switch $$ 2 . Switch

Consider the switch statement in C-like languages, defined here according to this grammar:
1. P -> Switch $$
2. Switch -> switch ( expr ){ Cases Default }
3. Cases -> Cases Case
4. Cases ->\epsi
5. Case -> case const: Stmt
6. Stmt -> stmt; break;
7. Stmt -> stmt;
8. Stmt ->\epsi
9. Default -> default: stmt;
10. Default ->\epsi
(a)(2pt) Compute the sets first(X) and follow(X), for all non-terminals X, and the sets
predict(p) for all production rules p.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!