Compiler Construction Lab Manual / Bottom down parsers SLR First

Program Name

Write a Compiler Construction Program for Bottom down parsers SLR First.
Theory
Bottom down parsers SLR First
Program Code


Saving: vi first.c

Compiling and Running
cc first.c
./a.out
Input and Output
Enter the no. of productions
9

Enter the productions
E=T+E
E=T
E=a
T=F*T
T=F

T=b
T=d
F=(E)
F=i

Enter element whose first is to be found
F
FIRST(F)={(i}
Do you want to continue -1,exit 0
1 Enter element whose first is to be found T
FIRST(T)={(ibd}
Do you want to continue -1,exit 0
1
Enter element whose first is to be found
E
FIRST(E)={(ibda}
Do you want to continue -1,exit 0
1
Enter element whose first is to be found
a
FIRST(a)={a}
Do you want to continue -1,exit 0
1
Enter element whose first is to be found
(
FIRST(()={(}
Do you want to continue -1,exit 0
0


Home     Back