in Compiler Design
149 views
0 votes
0 votes
Q1. For the following grammar
    N -> AB | BA
    A -> a | CAC
    B -> b | CBC
    C -> a | b

 Find the FIRST and FOLLOW
in Compiler Design
by
149 views

1 Answer

0 votes
0 votes
Fi(N) = Fi(A) |  Fi(B) = a|b| FI(C) = a|b

Fi(A)= a|Fi(C) = a|b

Fi(B)= b| Fi(C) =b|a

Fi(C) = a|b

 

Fo(N) =$

F0(A) = Fi(B) + Fi(A) + Fo(N) +Fo(A)= b+a+$

F0(B) = Fi(A) + Fi(C) + Fo(B) + Fo(N)= b+a+$

F0(C) = Fi(BC) + Fi(AC) + Fo(A)+ Fo(B) =  b+a+$

 

Please correct me if I’m wrong!

1 comment

What is the answer
0
0

Related questions