SlideShare uma empresa Scribd logo
1 de 8
Walchand Institute of Technology 
Seminar On 
Symbol Table Genearation 
Presented by…… 
Name 
Shikha 
Gajul Pooja 
Kingi Kavita 
NamaBabita 
Pobatti Vaishali
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
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.
#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; 
}
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(); 
}
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;
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; 
}
INPUT

Mais conteúdo relacionado

Mais procurados (20)

Yacc topic beyond syllabus
Yacc   topic beyond syllabusYacc   topic beyond syllabus
Yacc topic beyond syllabus
 
Compiler unit 4
Compiler unit 4Compiler unit 4
Compiler unit 4
 
Lex & yacc
Lex & yaccLex & yacc
Lex & yacc
 
6 compiler lab - Flex
6 compiler lab - Flex6 compiler lab - Flex
6 compiler lab - Flex
 
Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generation
 
Handout#08
Handout#08Handout#08
Handout#08
 
Handout#09
Handout#09Handout#09
Handout#09
 
Compiler Design File
Compiler Design FileCompiler Design File
Compiler Design File
 
Clanguage
ClanguageClanguage
Clanguage
 
Assignment4
Assignment4Assignment4
Assignment4
 
Lexical analysis-using-lex
Lexical analysis-using-lexLexical analysis-using-lex
Lexical analysis-using-lex
 
Lexical analyzer generator lex
Lexical analyzer generator lexLexical analyzer generator lex
Lexical analyzer generator lex
 
Symbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code GenerationSymbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code Generation
 
Assignment2
Assignment2Assignment2
Assignment2
 
C language ppt
C language pptC language ppt
C language ppt
 
C intro
C introC intro
C intro
 
Assignment5
Assignment5Assignment5
Assignment5
 
Unit iii
Unit iiiUnit iii
Unit iii
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language Course
 
C presentation
C presentationC presentation
C presentation
 

Semelhante a What is symbol table?

Semelhante a What is symbol table? (20)

C programming(part 3)
C programming(part 3)C programming(part 3)
C programming(part 3)
 
C data type format specifier
C data type format specifierC data type format specifier
C data type format specifier
 
Unit 2 CMath behind coding.pptx
Unit 2 CMath behind coding.pptxUnit 2 CMath behind coding.pptx
Unit 2 CMath behind coding.pptx
 
C,c++ interview q&a
C,c++ interview q&aC,c++ interview q&a
C,c++ interview q&a
 
Functions struct&union
Functions struct&unionFunctions struct&union
Functions struct&union
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
 
presentation_functions_1443207686_140676.ppt
presentation_functions_1443207686_140676.pptpresentation_functions_1443207686_140676.ppt
presentation_functions_1443207686_140676.ppt
 
CP Handout#2
CP Handout#2CP Handout#2
CP Handout#2
 
data_structure (1).pptx
data_structure (1).pptxdata_structure (1).pptx
data_structure (1).pptx
 
OOC MODULE1.pptx
OOC MODULE1.pptxOOC MODULE1.pptx
OOC MODULE1.pptx
 
Language design and translation issues
Language design and translation issuesLanguage design and translation issues
Language design and translation issues
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Function
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptx
 
C tutorial
C tutorialC tutorial
C tutorial
 
X++ 1.pptx
X++ 1.pptxX++ 1.pptx
X++ 1.pptx
 
Chapter3
Chapter3Chapter3
Chapter3
 
U5 SPC.pptx
U5 SPC.pptxU5 SPC.pptx
U5 SPC.pptx
 
U5 SPC.pptx
U5 SPC.pptxU5 SPC.pptx
U5 SPC.pptx
 
C
CC
C
 
qb unit2 solve eem201.pdf
qb unit2 solve eem201.pdfqb unit2 solve eem201.pdf
qb unit2 solve eem201.pdf
 

Mais de Satyamevjayte Haxor (18)

Processes and threads
Processes and threadsProcesses and threads
Processes and threads
 
Patterns
PatternsPatterns
Patterns
 
Uml class Diagram
Uml class DiagramUml class Diagram
Uml class Diagram
 
Uml Common Mechanism
Uml Common MechanismUml Common Mechanism
Uml Common Mechanism
 
Types and roles
Types and rolesTypes and roles
Types and roles
 
States machine
States machineStates machine
States machine
 
Lexical
LexicalLexical
Lexical
 
Linker
LinkerLinker
Linker
 
sCode optimization
sCode optimizationsCode optimization
sCode optimization
 
Single Pass Assembler
Single Pass AssemblerSingle Pass Assembler
Single Pass Assembler
 
Nested micro
Nested microNested micro
Nested micro
 
Multiplier control unit
Multiplier control unitMultiplier control unit
Multiplier control unit
 
Control unit design
Control unit designControl unit design
Control unit design
 
Direct linking loaders
Direct linking loadersDirect linking loaders
Direct linking loaders
 
Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
 
Compilers
CompilersCompilers
Compilers
 
Keyword Presentation
Keyword PresentationKeyword Presentation
Keyword Presentation
 
Linking in MS-Dos System
Linking in MS-Dos SystemLinking in MS-Dos System
Linking in MS-Dos System
 

Último

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...software pro Development
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 

Último (20)

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 

What is symbol table?

  • 1. Walchand Institute of Technology Seminar On Symbol Table Genearation Presented by…… Name Shikha Gajul Pooja Kingi Kavita NamaBabita Pobatti Vaishali
  • 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. 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. #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. 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. 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. 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; }