Question: BCSE 3 0 7 P - COMPILER DESIGN LAB Date: 2 3 . 0 1 . 2 0 2 4 Aim : To write a

BCSE307P - COMPILER DESIGN LAB
Date: 23.01.2024
Aim : To write a C++Program to create symbol table
Detailed Description of Exercise2
A Symbol table is a data structure used by the compiler, where each identifier in program's soure code is stored along with information associated with it relating to its declaration. It stores identifier as well as it's associated attributes like scope, type, line-number of occurrence, etc. Write a C++ program to construct symbol table for an input C program.
Test case 1
Sample Input:
Enter Program $ for termination:
void main()
i
int a=20;
printf("%)/a), a);
}
Sample Output:
\table[[Name,Type,Size,Address],[a,int,4,2024]]
Test case 2
Sample Input:
Enter Program $ for termination:
void main()
{
int num1,num2,sum;
scanf("%d%d",&num1,&num2)
sum=num1+num2;
printf("% d",sum);
is
Sample Output:
\table[[Name,Type,Size,Address]]
\table[[num1,int,4,2024],[num2,int,4,3012],[sum,int,4,3048]]
 BCSE307P - COMPILER DESIGN LAB Date: 23.01.2024 Aim : To write

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 Databases Questions!