Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Walchand Institute of Technology 
Seminar On 
Symbol Table Genearation 
Presented by…… 
Name 
Shikha 
Gajul Pooja 
Kingi K...
What is Symbol Table ? 
The compiler has to identifier used in source program. 
It has to collect information about them l...
USE OF SYMBOL TABLE 
Symbol table information is used by the analysis and synthesis 
phases. 
To verify that used identifi...
#include<stdio.h> 
#include<conio.h> 
#include<string.h> 
void check_var(); 
FILE *fp; 
char ch; 
int i,j,k,m,ptr; 
char *...
while((ch=fgetc(fp))!=EOF) 
{ 
i=0; 
*word=NULL; 
while((ch!='n')&(ch!=' ')&(ch!=EOF)) 
{ 
word[i]=ch; 
ch=fgetc(fp); 
i++...
void check_var(char *word) 
{ 
char word1[10]; 
int n; 
ch=fgetc(fp); 
while((ch!=';')&&(ch!='n')&&(ch!=EOF)) 
{ 
printf("...
while((ch!=',')&&(ch!=';')&&(ch!=EOF)) 
{ 
word1[n]=ch; 
ch=fgetc(fp); 
n++; 
} 
m=strlen(word1); 
if(m!=n) 
{ 
word1[n]='...
INPUT
Upcoming SlideShare
Loading in …5
×

What is symbol table?

Symbol table what does it mean and its program

  • Be the first to comment

What is symbol table?

  1. 1. Walchand Institute of Technology Seminar On Symbol Table Genearation Presented by…… Name Shikha Gajul Pooja Kingi Kavita NamaBabita Pobatti Vaishali
  2. 2. What is Symbol Table ? The compiler has to identifier used in source program. It has to collect information about them like storage allocation for an identifier it’s type, scope where in program they are valid and in procedure name information about the : Type of its argument, Method of passing of this arguments , Type returned. All this is stored in data structure called Symbol Table. A symbol table is a necessary component because  Declaration of identifiers appears once in a program  Use of identifiers may appear in many places of the program text
  3. 3. USE OF SYMBOL TABLE Symbol table information is used by the analysis and synthesis phases. To verify that used identifiers have been defined (declared). To verify that expressions and assignments are semantically correct – type checking. To generate intermediate or target code.
  4. 4. #include<stdio.h> #include<conio.h> #include<string.h> void check_var(); FILE *fp; char ch; int i,j,k,m,ptr; char *str1[]={"int","float","char"}; void main() { char *word; clrscr(); printf("ntData type tLengthttSymbolttAddress"); fp=fopen("c:turboc3s.c","r"); if(fp==NULL) { printf("nCan't open a file."); return; }
  5. 5. while((ch=fgetc(fp))!=EOF) { i=0; *word=NULL; while((ch!='n')&(ch!=' ')&(ch!=EOF)) { word[i]=ch; ch=fgetc(fp); i++; } m=strlen(word); if(m!=i) { word[i]='0'; } for(k=0;k<3;k++) { ptr=strcmp(&(str1[k][0]),word); if(ptr==0) check_var(word); } } getch(); }
  6. 6. void check_var(char *word) { char word1[10]; int n; ch=fgetc(fp); while((ch!=';')&&(ch!='n')&&(ch!=EOF)) { printf("nnt"); fputs(word,stdout); if(k==0) fputs("tt2 bytes",stdout); else if(k==1) fputs("tt4 bytes",stdout); else if(k==2) fputs("tt1 byte ",stdout); n=0;
  7. 7. while((ch!=',')&&(ch!=';')&&(ch!=EOF)) { word1[n]=ch; ch=fgetc(fp); n++; } m=strlen(word1); if(m!=n) { word1[n]='0'; } printf("tt%s",word1); printf("tt%ld",*word1); ch=fgetc(fp); } return; }
  8. 8. INPUT

×