Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a)start = A <EOF>; A = B, C; B = \"a\" , B ,\"a\" | D; C = D , E , F ; D = E , \

ID: 3631094 • Letter: A

Question


a)start = A <EOF>;
A = B, C;
B = "a" , B ,"a" | D;
C = D , E , F ;
D = E , "b" , D|F ;
E = A | "C" ;
F = "d" , "d" , F| epslon;
==========================
b) start = A <EOF>;
A = B , D|C , D;
B = "a" , B , "a" | "b" , "b" ;
C = "c" , E , F | F;
D = "a" |"b" | "c" ;
E = "c" E "b" | epslon
F = D | epslon;
===============================
c) start = A <EOF> ;
A = C , B | EPSLON;
B = ";" , C , B |EPSLON;
C = D , "=" , E|E;
D = "i" | "j" | "k" ;
E = <number> , F ;
F = "+" , E | "-" , E | "*" , E | "/" , E |epslon ;
==============

Explanation / Answer

I assume "," is also a terminal, and has not been given to separate things..

Even if , was put to separate things, then too, answer wont be different..

(a) NOT ll(1)
indirect left recursion for non-terminal A
A-> B -> D -> E -> A

(b) NOT ll(1)
take rule C -> "c"...|F
Now "c" is in the first of F as well (F-> D ->"c")
So, it not LL(1)

(c) LL(1)
No direct/indirect recursion
no clash in first and follow

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote