1 consider the following cfg thatdescribes some simple statements of c c or java ter 5346438
1) Consider the following CFG thatdescribes some simple statements of C/C++ or Java:
Terminals = {id, num, if, else, print, =, {, }, ;, (, ), }
Non-Terminals = {S, E, B, L}
Rules = (1) S → print(E);
(2) S → while (B) S
(3) S → {L}
(4) E → id
(5) E → num
(6) B → E > E
(7) L → S
(8) L → S L
StartSymbol = S
Show the derivation for the statements
(a)while (id > num) print(id)
Answer Here:
(b){ print(id); print(num); }
Answer Here:
(c) Show(No hand drawing) the parse tree for the statementprint(id)