+1 vote
379 views
in Compilers & Operating Systems by

1 Answer

+1 vote
by
selected by (user.guest)
 
Best answer

LEXICAL ANALYSIS Vs PARSING:

There are a number of reasons why the analysis portion of a compiler is normally separated into lexical analysis and parsing (syntax analysis) phases. 

1. Simplicity of design is the most important consideration: The separation of Lexical and Syntactic analysis often allows us to simplify at least one of these tasks. For example, a parser that had to deal with comments and whitespace as syntactic units would be considerably more complex than one that can assume comments and whitespace have already been removed by the lexical analyzer. 

2. Compiler efficiency is improved: A separate lexical analyzer allows us to apply specialized techniques that serve only the lexical task, not the job of parsing. In addition, specialized buffering techniques for reading input characters can speed up the compiler significantly. 

3. Compiler portability is enhanced: Input-device-specific peculiarities can be restricted to the lexical analyzer.


Related questions

+1 vote
1 answer 480 views
+3 votes
1 answer 1.9k views
+1 vote
1 answer 274 views
asked May 24, 2021 in Compilers & Operating Systems by anonymous
0 votes
1 answer 85 views
+1 vote
1 answer 273 views
+2 votes
1 answer 2.1k views
+2 votes
1 answer 6.7k views
+2 votes
1 answer 597 views
Welcome to CPENTalk.com
Solution-oriented students of computer engineering on one platform to get you that

ONE SOLUTION

...