Concepts of Programming Languages (11th Edition)
Concepts of Programming Languages (11th Edition)
11th Edition
ISBN: 9780133943023
Author: Robert W. Sebesta
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 4, Problem 2RQ

Explanation of Solution

Lexical analysis and syntax analysis:

Syntax analyzer phase in compilation process is the step in which the “tokens” in the programs are identified and recognize whether they are specified in a valid way. In simple words, tokens are the keywords, identifiers and operators in a program. Often, syntax analysis consists of two parts, namely:

  • Lexical analysis: It does the analysis of small language constructs like names and numeric literals.
  • Syntax analysis: It does the analysis of large constructs like expressions and program units.

The following three reasons explain why lexical analysis is a separate part from the syntax analyzing process.

Simplicity:

The process of lexical analysis needs relatively less complex techniques than syntax analysis. So, separating low-level details of lexical analysis from syntax analysis make the process of lexical analysis simple, small and clean...

Blurred answer
Students have asked these similar questions
Explain the three reasons why lexical analysis is separated from syntaxanalysis
What are three reasons why syntax analyzers are based on grammars?
What are the functionalities of Lexical Analysis and Syntax Analysis? Explain with an example
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage