Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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]]
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions