2
Most read
Subject: Automata Theory And Compiler Design
Topic: Lexical Analysis Phase Of Compiler
Guided By: Presented By:
Sindhu G Yashaswini S(1KT21IS046)
Dept of ISE.
INTRODUCTION:
 The scanning/lexical analysis phase of a
compiler performs the task of reading the source
program as a file of characters and dividing up
into tokens.
 Usually implemented as subroutine or co-routine of
parser.
 Front end of compiler.
 Each token is a sequence of characters that represents a
unit of information in the source program.
EXAMPLES OF TOKENS:
 Keywords which are fixed string of letters .eg: “if”,
“while”.
 Identifiers which are user-defined strings composed of
letters and numbers.
 Special symbols like arithmetic symbols.
APPLICATIONS:
 Scanners perform pattern matching process.
 The techniques used to implement lexical analyzers can
also be applied to other areas such as query languages
and information retrieval systems.
 Since pattern directed programming is widely useful,
pattern action language called Lex for specifying lexical
analyzers.
 In lex , patterns are specified by regular expressions, and
a compiler for lex can generate an efficient finite-
automaton recognizer for the regular expression
THE ROLE OF LEXICALANALYZER:
 Lexical analyzer is the first phase of a compiler.
 Its main task is to read input characters and produce as output a
sequence of tokens that parser uses for syntax analysis.
 If the lexical analyzer is located as a separate pass in the compiler it can
need an intermediate file to locate its output, from which the parser
would then takes its input.
 The lexical analyzer also interacts with the symbol table while passing
tokens to the parser. Whenever a token is discovered, the lexical
analyzer returns a representation for that token to the parser.
 If the token is a simple construct including parenthesis, comma, or a
colon, then it returns an integer program. If the token is a more complex
items including an identifier or another token with a value, the value is
also passed to the parser.
ISSUES IN LEXICALANALYSIS:
 There are several reasons for separating the analysis
phase of compiling into lexical analysis and parsing:
 It leads to simpler design of the parser as the unnecessary
tokens can be eliminated by scanner.
 Efficiency of the process of compilation is improved.
The lexical analysis phase is most time consuming phase
in compilation.
 buffering to improve the speed of compilation.
automata theroy and compiler designc.pptx

More Related Content

PPT
Data design and analysis of computing tools
PPTX
Chapter 2.pptx compiler design lecture note
PDF
An Introduction to the Compiler Designss
PPTX
Cd ch2 - lexical analysis
PPTX
Compiler Design.pptx
PDF
11700220036.pdf
PPT
Lexical Analysis
PDF
COMPILER DESIGN.pdf
Data design and analysis of computing tools
Chapter 2.pptx compiler design lecture note
An Introduction to the Compiler Designss
Cd ch2 - lexical analysis
Compiler Design.pptx
11700220036.pdf
Lexical Analysis
COMPILER DESIGN.pdf

Similar to automata theroy and compiler designc.pptx (20)

PDF
Structure of a Compiler, Compiler and Interpreter, Lexical Analysis: Role of ...
PPTX
"Lexical Analysis for GATE and CS Exams"
DOCX
Compiler Design
PPTX
Language for specifying lexical Analyzer
PPTX
Compiler Construction ( lexical analyzer).pptx
PPTX
Role-of-lexical-analysis
PPT
1.Role lexical Analyzer
PDF
role of lexical parser compiler design1-181124035217.pdf
PPTX
ashjhas sahdj ajshbas sajakj askk sadk as
PPTX
A Role of Lexical Analyzer
PPT
Lexical Analysis
PPTX
Valuable Information on Lexical Analysis in Compiler Design
PDF
compiler.pdfljdvgepitju4io3elkhldhyreyio4uw
PPTX
Structure of the compiler
PPTX
phases of compiler-analysis phase
PPTX
COMPILER CONSTRUCTION KU 1.pptx
PPT
Chapter-2-lexical-analyser and its property lecture note.ppt
PDF
Lexical analysis - Compiler Design
PDF
Lexical Analysis.pdf
PPTX
Chahioiuou9oioooooooooooooofffghfpterTwo.pptx
Structure of a Compiler, Compiler and Interpreter, Lexical Analysis: Role of ...
"Lexical Analysis for GATE and CS Exams"
Compiler Design
Language for specifying lexical Analyzer
Compiler Construction ( lexical analyzer).pptx
Role-of-lexical-analysis
1.Role lexical Analyzer
role of lexical parser compiler design1-181124035217.pdf
ashjhas sahdj ajshbas sajakj askk sadk as
A Role of Lexical Analyzer
Lexical Analysis
Valuable Information on Lexical Analysis in Compiler Design
compiler.pdfljdvgepitju4io3elkhldhyreyio4uw
Structure of the compiler
phases of compiler-analysis phase
COMPILER CONSTRUCTION KU 1.pptx
Chapter-2-lexical-analyser and its property lecture note.ppt
Lexical analysis - Compiler Design
Lexical Analysis.pdf
Chahioiuou9oioooooooooooooofffghfpterTwo.pptx
Ad

Recently uploaded (20)

PPTX
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PPTX
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
PPTX
communication and presentation skills 01
PDF
Design Guidelines and solutions for Plastics parts
PPT
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
PDF
ChapteR012372321DFGDSFGDFGDFSGDFGDFGDFGSDFGDFGFD
PPTX
Fundamentals of Mechanical Engineering.pptx
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PPTX
Feature types and data preprocessing steps
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPTX
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PPTX
CyberSecurity Mobile and Wireless Devices
PPTX
"Array and Linked List in Data Structures with Types, Operations, Implementat...
PDF
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
PPTX
Software Engineering and software moduleing
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
communication and presentation skills 01
Design Guidelines and solutions for Plastics parts
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
ChapteR012372321DFGDSFGDFGDFSGDFGDFGDFGSDFGDFGFD
Fundamentals of Mechanical Engineering.pptx
III.4.1.2_The_Space_Environment.p pdffdf
Feature types and data preprocessing steps
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
CyberSecurity Mobile and Wireless Devices
"Array and Linked List in Data Structures with Types, Operations, Implementat...
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
Software Engineering and software moduleing
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
Ad

automata theroy and compiler designc.pptx

  • 1. Subject: Automata Theory And Compiler Design Topic: Lexical Analysis Phase Of Compiler Guided By: Presented By: Sindhu G Yashaswini S(1KT21IS046) Dept of ISE.
  • 2. INTRODUCTION:  The scanning/lexical analysis phase of a compiler performs the task of reading the source program as a file of characters and dividing up into tokens.  Usually implemented as subroutine or co-routine of parser.  Front end of compiler.  Each token is a sequence of characters that represents a unit of information in the source program.
  • 3. EXAMPLES OF TOKENS:  Keywords which are fixed string of letters .eg: “if”, “while”.  Identifiers which are user-defined strings composed of letters and numbers.  Special symbols like arithmetic symbols.
  • 4. APPLICATIONS:  Scanners perform pattern matching process.  The techniques used to implement lexical analyzers can also be applied to other areas such as query languages and information retrieval systems.  Since pattern directed programming is widely useful, pattern action language called Lex for specifying lexical analyzers.  In lex , patterns are specified by regular expressions, and a compiler for lex can generate an efficient finite- automaton recognizer for the regular expression
  • 5. THE ROLE OF LEXICALANALYZER:  Lexical analyzer is the first phase of a compiler.  Its main task is to read input characters and produce as output a sequence of tokens that parser uses for syntax analysis.
  • 6.  If the lexical analyzer is located as a separate pass in the compiler it can need an intermediate file to locate its output, from which the parser would then takes its input.  The lexical analyzer also interacts with the symbol table while passing tokens to the parser. Whenever a token is discovered, the lexical analyzer returns a representation for that token to the parser.  If the token is a simple construct including parenthesis, comma, or a colon, then it returns an integer program. If the token is a more complex items including an identifier or another token with a value, the value is also passed to the parser.
  • 7. ISSUES IN LEXICALANALYSIS:  There are several reasons for separating the analysis phase of compiling into lexical analysis and parsing:  It leads to simpler design of the parser as the unnecessary tokens can be eliminated by scanner.  Efficiency of the process of compilation is improved. The lexical analysis phase is most time consuming phase in compilation.  buffering to improve the speed of compilation.