SlideShare a Scribd company logo
SYSTEM PROGRAMMING
TOPIC : Overview of Language Processor : Fundamentals of LP , Symbol
Table , Data Structure for LP
SUBMITTED BY :
Bhavin Darji
SUBMITTED TO :
Prof.
Fundamentals of Language Processor
Language Processing = Analysis of SP + Synthesis of TP
Source program as a analysis phase
Target program in synthesis phase
There are 3 components
◦ Lexical rule
◦ Syntax rule
◦ Semantic rule
Analysis Phase
This specification consists of three components
Lexical rules
Specify the information and formation of valid lexical units in the source language
Syntax Rules
Specify the information and formation of valid statements in the source language
Semantic Rules
Associated with valid statements of language
Consider the following example
A = (B* 100) /D;
Lexical units identifies =, * and / operators, 100 as constant, and the remaining strings
as identifiers.
Syntax analysis identifies the statement as an assignment statement with A as the left
hand side and (B * 100) / D as the expression on the right hand side.
Semantic analysis determines the meaning of the statement to be the assignment of
B X 100 / D to A.
Synthesis Phase
 It performs two main activities:
 Creation of data structures in the target program (memory allocation)
 Generation of target code (code generation)
 Example
MOVER AREG, PROFIT
MULT AREG, 100
DIV AREG, COST_PRICE MOVEM AREG, PERCENT_PROFIT
…
Lexical Analysis
Reads the source code & divide the source code into tokens.
Token is group of characters with meaning.
Lexical analyzer takes a stream of Lexeme as a input and the output is stream of token.
Example
int a , b;
int Ans;
ans = a+b;
Symbol Type Address
1. int keyword
2. a Identifier 2000
Syntax Analysis
Done in order to verify the grammatical mistake of source code.
Takes a stream of tokens as input and generate a syntax tree.
Example : a=b*c
=
a *
b c
Semantic Analysis
It verify the meaning of each and every sentence.
It just verify weather an operator is operating on required number of operand or not.
Example : int a , b, ans ;
ans = a + b;
Intermediate code generation
Source code is converted into a intermediate representation known as three address code.
Example :
◦ A = b*c+d;
◦ T1=b*c;
◦ A=t1+d;
After this four analysis we get our target program.
The Symbol Table
Advance data structure used by compiler to store complete information of source code at any
phase
If new variable encountered that should be store into the symbol table.
Communicate with each and every phase of compiler.
Lexical
Analyzer
Semantic
Analyzer
Code
Generator
Symbol
Table
Syntax
Analyzer
Criteria of Classification of Data Structure
of LP:
Nature of a Data Structure :
◦ Linear or
◦ Non Linear
Purpose of a Data Structure :
◦ Search or
◦ Allocation
Linear Data Structure
Consist of a linear arrangement of elements in the memory.
Advantage : Facilities Efficient Search
Disadvantage :
◦ Require a contagious area of memory
◦ Wastage of Memory
Non Linear Data Structure
Overcomes the disadvantage of Linear DS.
Elements of Non linear DS are accessed using pointers.
Elements need not occupy contiguous area of memory.
Symbol Table Organization
Sequential Search Organization
#1
#2
#f
#n
Occupied Entries
Free Entries
n: Number of entries in the table f: Number of occupied entries
(2)Binary Search Organization
All entries in a table are assumed to satisfy an ordering relation.
‘<‘ relation implies that the symbol occupying an entry is ‘smaller or larger than’ the symbol.
If the new symbol is smaller then it will be put at left side otherwise put at right side.
Every new symbol the existing symbol may have to be shifted to ensure ordering
relation.
Hence , this is not good for the symbol table.
It is suitable for table which has fixed set of symbol.
Ex. Table of reserve word in a programming language.
(3)Hash Table Organization
There are three possibilities when eth entry will be arrived :
- Entry may be occupied by symbol S.
- Entry may be occupied by some other symbol.
- Entry may not occupied.
 Collision: when eth entry will be occupied by some other entry then that is collision.
A simple solution to avoid collision is to enter a distinct entry in symbol table. This technique is
known as direct entry organization.
Allocation Data Structures
1)Stacks
A linear data structure which satisfies following properties:
- Allocation and de-allocation are performed in a LIFO manner.
- Only last element is accessible at any time.
It has a limited size
2)Heaps
Non Linear Data Structure
It is used for dynamic memory
Permits allocation and de-allocation of entities in random order
We are responsible to de-allocate the memory
It has no size restriction
We use pointer to access it , so it is slightly slower.
THANK YOU
Ad

More Related Content

What's hot (20)

Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
Hemant Sharma
 
Assemblers
AssemblersAssemblers
Assemblers
Dattatray Gandhmal
 
Recursion in C++
Recursion in C++Recursion in C++
Recursion in C++
Maliha Mehr
 
Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction tools
Akhil Kaushik
 
Single pass assembler
Single pass assemblerSingle pass assembler
Single pass assembler
Bansari Shah
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
Kuppusamy P
 
Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)   Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)
Tasif Tanzim
 
Data Representation
Data RepresentationData Representation
Data Representation
Dilum Bandara
 
Computer Oragnization Flipflops
Computer Oragnization FlipflopsComputer Oragnization Flipflops
Computer Oragnization Flipflops
Vanitha Chandru
 
COMPILER DESIGN
COMPILER DESIGNCOMPILER DESIGN
COMPILER DESIGN
Vetukurivenkatashiva
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
Akhil Kaushik
 
Intermediate code generator
Intermediate code generatorIntermediate code generator
Intermediate code generator
sanchi29
 
Operator precedence
Operator precedenceOperator precedence
Operator precedence
Akshaya Arunan
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
Muhammed Afsal Villan
 
Files
FilesFiles
Files
kirtidhamija16
 
System Programming- Unit I
System Programming- Unit ISystem Programming- Unit I
System Programming- Unit I
Saranya1702
 
Message passing ( in computer science)
Message   passing  ( in   computer  science)Message   passing  ( in   computer  science)
Message passing ( in computer science)
Computer_ at_home
 
Design of a two pass assembler
Design of a two pass assemblerDesign of a two pass assembler
Design of a two pass assembler
Dhananjaysinh Jhala
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
Mukesh Tekwani
 
Additional Relational Algebra Operations
Additional Relational Algebra OperationsAdditional Relational Algebra Operations
Additional Relational Algebra Operations
A. S. M. Shafi
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
Hemant Sharma
 
Recursion in C++
Recursion in C++Recursion in C++
Recursion in C++
Maliha Mehr
 
Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction tools
Akhil Kaushik
 
Single pass assembler
Single pass assemblerSingle pass assembler
Single pass assembler
Bansari Shah
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
Kuppusamy P
 
Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)   Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)
Tasif Tanzim
 
Computer Oragnization Flipflops
Computer Oragnization FlipflopsComputer Oragnization Flipflops
Computer Oragnization Flipflops
Vanitha Chandru
 
Intermediate code generator
Intermediate code generatorIntermediate code generator
Intermediate code generator
sanchi29
 
System Programming- Unit I
System Programming- Unit ISystem Programming- Unit I
System Programming- Unit I
Saranya1702
 
Message passing ( in computer science)
Message   passing  ( in   computer  science)Message   passing  ( in   computer  science)
Message passing ( in computer science)
Computer_ at_home
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
Mukesh Tekwani
 
Additional Relational Algebra Operations
Additional Relational Algebra OperationsAdditional Relational Algebra Operations
Additional Relational Algebra Operations
A. S. M. Shafi
 

Similar to Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Structure for LP (20)

Parsing
ParsingParsing
Parsing
Dayananda Sagar University
 
Cs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer KeyCs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer Key
appasami
 
Chapter-3 compiler.pptx course materials
Chapter-3 compiler.pptx course materialsChapter-3 compiler.pptx course materials
Chapter-3 compiler.pptx course materials
gadisaAdamu
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
Anujashejwal
 
Pcd question bank
Pcd question bank Pcd question bank
Pcd question bank
Sumathi Gnanasekaran
 
Semantics analysis
Semantics analysisSemantics analysis
Semantics analysis
Bilalzafar22
 
Syntax directed definition and intermediate code generation
Syntax directed definition and intermediate code generationSyntax directed definition and intermediate code generation
Syntax directed definition and intermediate code generation
JananiRamannachetty1
 
Module 3 - Semantic Analysis(Compiler Design).pptx
Module 3 - Semantic Analysis(Compiler Design).pptxModule 3 - Semantic Analysis(Compiler Design).pptx
Module 3 - Semantic Analysis(Compiler Design).pptx
muralidharanm2022
 
Chapter _4_Semantic Analysis .pptx
Chapter _4_Semantic Analysis .pptxChapter _4_Semantic Analysis .pptx
Chapter _4_Semantic Analysis .pptx
ArebuMaruf
 
Symbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code GenerationSymbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code Generation
Akhil Kaushik
 
Compiler Design in Engineering for Designing
Compiler Design in Engineering for DesigningCompiler Design in Engineering for Designing
Compiler Design in Engineering for Designing
Adityaverma750841
 
Compiler chapter six .ppt course material
Compiler chapter six .ppt course materialCompiler chapter six .ppt course material
Compiler chapter six .ppt course material
gadisaAdamu
 
compiler design course focus of chapter 3 and 4 part
compiler design course focus of chapter 3 and 4 partcompiler design course focus of chapter 3 and 4 part
compiler design course focus of chapter 3 and 4 part
abel185080
 
Compilers Design
Compilers DesignCompilers Design
Compilers Design
Akshaya Arunan
 
UNIT - III Compiler.pptx SYNTAX DIRECTED
UNIT - III Compiler.pptx SYNTAX DIRECTEDUNIT - III Compiler.pptx SYNTAX DIRECTED
UNIT - III Compiler.pptx SYNTAX DIRECTED
KavithaNagendran1
 
Plc part 2
Plc  part 2Plc  part 2
Plc part 2
Taymoor Nazmy
 
Unit 3 Compiler Design Regulation 2021.pptx
Unit 3 Compiler Design Regulation 2021.pptxUnit 3 Compiler Design Regulation 2021.pptx
Unit 3 Compiler Design Regulation 2021.pptx
jeevitha404389
 
INTERMEDIATE CODE GENERTION-CD UNIT-3.pdf
INTERMEDIATE CODE GENERTION-CD UNIT-3.pdfINTERMEDIATE CODE GENERTION-CD UNIT-3.pdf
INTERMEDIATE CODE GENERTION-CD UNIT-3.pdf
Ranjeet Reddy
 
Designing A Syntax Based Retrieval System03
Designing A Syntax Based Retrieval System03Designing A Syntax Based Retrieval System03
Designing A Syntax Based Retrieval System03
Avelin Huo
 
Symbol Table.pptx
Symbol Table.pptxSymbol Table.pptx
Symbol Table.pptx
LaibaFaisal3
 
Cs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer KeyCs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer Key
appasami
 
Chapter-3 compiler.pptx course materials
Chapter-3 compiler.pptx course materialsChapter-3 compiler.pptx course materials
Chapter-3 compiler.pptx course materials
gadisaAdamu
 
Semantics analysis
Semantics analysisSemantics analysis
Semantics analysis
Bilalzafar22
 
Syntax directed definition and intermediate code generation
Syntax directed definition and intermediate code generationSyntax directed definition and intermediate code generation
Syntax directed definition and intermediate code generation
JananiRamannachetty1
 
Module 3 - Semantic Analysis(Compiler Design).pptx
Module 3 - Semantic Analysis(Compiler Design).pptxModule 3 - Semantic Analysis(Compiler Design).pptx
Module 3 - Semantic Analysis(Compiler Design).pptx
muralidharanm2022
 
Chapter _4_Semantic Analysis .pptx
Chapter _4_Semantic Analysis .pptxChapter _4_Semantic Analysis .pptx
Chapter _4_Semantic Analysis .pptx
ArebuMaruf
 
Symbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code GenerationSymbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code Generation
Akhil Kaushik
 
Compiler Design in Engineering for Designing
Compiler Design in Engineering for DesigningCompiler Design in Engineering for Designing
Compiler Design in Engineering for Designing
Adityaverma750841
 
Compiler chapter six .ppt course material
Compiler chapter six .ppt course materialCompiler chapter six .ppt course material
Compiler chapter six .ppt course material
gadisaAdamu
 
compiler design course focus of chapter 3 and 4 part
compiler design course focus of chapter 3 and 4 partcompiler design course focus of chapter 3 and 4 part
compiler design course focus of chapter 3 and 4 part
abel185080
 
UNIT - III Compiler.pptx SYNTAX DIRECTED
UNIT - III Compiler.pptx SYNTAX DIRECTEDUNIT - III Compiler.pptx SYNTAX DIRECTED
UNIT - III Compiler.pptx SYNTAX DIRECTED
KavithaNagendran1
 
Unit 3 Compiler Design Regulation 2021.pptx
Unit 3 Compiler Design Regulation 2021.pptxUnit 3 Compiler Design Regulation 2021.pptx
Unit 3 Compiler Design Regulation 2021.pptx
jeevitha404389
 
INTERMEDIATE CODE GENERTION-CD UNIT-3.pdf
INTERMEDIATE CODE GENERTION-CD UNIT-3.pdfINTERMEDIATE CODE GENERTION-CD UNIT-3.pdf
INTERMEDIATE CODE GENERTION-CD UNIT-3.pdf
Ranjeet Reddy
 
Designing A Syntax Based Retrieval System03
Designing A Syntax Based Retrieval System03Designing A Syntax Based Retrieval System03
Designing A Syntax Based Retrieval System03
Avelin Huo
 
Ad

Recently uploaded (20)

Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E..."Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
Infopitaara
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
Avnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights FlyerAvnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights Flyer
WillDavies22
 
Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.
anuragmk56
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Journal of Soft Computing in Civil Engineering
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptxtheory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E..."Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
Infopitaara
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
Avnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights FlyerAvnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights Flyer
WillDavies22
 
Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.
anuragmk56
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptxtheory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
Ad

Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Structure for LP

  • 1. SYSTEM PROGRAMMING TOPIC : Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Structure for LP SUBMITTED BY : Bhavin Darji SUBMITTED TO : Prof.
  • 2. Fundamentals of Language Processor Language Processing = Analysis of SP + Synthesis of TP Source program as a analysis phase Target program in synthesis phase There are 3 components ◦ Lexical rule ◦ Syntax rule ◦ Semantic rule
  • 3. Analysis Phase This specification consists of three components Lexical rules Specify the information and formation of valid lexical units in the source language Syntax Rules Specify the information and formation of valid statements in the source language Semantic Rules Associated with valid statements of language
  • 4. Consider the following example A = (B* 100) /D; Lexical units identifies =, * and / operators, 100 as constant, and the remaining strings as identifiers. Syntax analysis identifies the statement as an assignment statement with A as the left hand side and (B * 100) / D as the expression on the right hand side. Semantic analysis determines the meaning of the statement to be the assignment of B X 100 / D to A.
  • 5. Synthesis Phase  It performs two main activities:  Creation of data structures in the target program (memory allocation)  Generation of target code (code generation)  Example MOVER AREG, PROFIT MULT AREG, 100 DIV AREG, COST_PRICE MOVEM AREG, PERCENT_PROFIT …
  • 6. Lexical Analysis Reads the source code & divide the source code into tokens. Token is group of characters with meaning. Lexical analyzer takes a stream of Lexeme as a input and the output is stream of token.
  • 7. Example int a , b; int Ans; ans = a+b; Symbol Type Address 1. int keyword 2. a Identifier 2000
  • 8. Syntax Analysis Done in order to verify the grammatical mistake of source code. Takes a stream of tokens as input and generate a syntax tree. Example : a=b*c = a * b c
  • 9. Semantic Analysis It verify the meaning of each and every sentence. It just verify weather an operator is operating on required number of operand or not. Example : int a , b, ans ; ans = a + b;
  • 10. Intermediate code generation Source code is converted into a intermediate representation known as three address code. Example : ◦ A = b*c+d; ◦ T1=b*c; ◦ A=t1+d; After this four analysis we get our target program.
  • 11. The Symbol Table Advance data structure used by compiler to store complete information of source code at any phase If new variable encountered that should be store into the symbol table. Communicate with each and every phase of compiler. Lexical Analyzer Semantic Analyzer Code Generator Symbol Table Syntax Analyzer
  • 12. Criteria of Classification of Data Structure of LP: Nature of a Data Structure : ◦ Linear or ◦ Non Linear Purpose of a Data Structure : ◦ Search or ◦ Allocation
  • 13. Linear Data Structure Consist of a linear arrangement of elements in the memory. Advantage : Facilities Efficient Search Disadvantage : ◦ Require a contagious area of memory ◦ Wastage of Memory
  • 14. Non Linear Data Structure Overcomes the disadvantage of Linear DS. Elements of Non linear DS are accessed using pointers. Elements need not occupy contiguous area of memory.
  • 16. Sequential Search Organization #1 #2 #f #n Occupied Entries Free Entries n: Number of entries in the table f: Number of occupied entries
  • 17. (2)Binary Search Organization All entries in a table are assumed to satisfy an ordering relation. ‘<‘ relation implies that the symbol occupying an entry is ‘smaller or larger than’ the symbol. If the new symbol is smaller then it will be put at left side otherwise put at right side. Every new symbol the existing symbol may have to be shifted to ensure ordering relation. Hence , this is not good for the symbol table. It is suitable for table which has fixed set of symbol. Ex. Table of reserve word in a programming language.
  • 18. (3)Hash Table Organization There are three possibilities when eth entry will be arrived : - Entry may be occupied by symbol S. - Entry may be occupied by some other symbol. - Entry may not occupied.  Collision: when eth entry will be occupied by some other entry then that is collision. A simple solution to avoid collision is to enter a distinct entry in symbol table. This technique is known as direct entry organization.
  • 19. Allocation Data Structures 1)Stacks A linear data structure which satisfies following properties: - Allocation and de-allocation are performed in a LIFO manner. - Only last element is accessible at any time. It has a limited size
  • 20. 2)Heaps Non Linear Data Structure It is used for dynamic memory Permits allocation and de-allocation of entities in random order We are responsible to de-allocate the memory It has no size restriction We use pointer to access it , so it is slightly slower.