Monday, November 20, 2023

In a compiler keywords of a language are recognized during ………………...


Answer: the lexical analysis of the program

Lexical analysis is the first phase of a compiler. It takes the source code from language preprocessors that are written in the form of sentences. The lexical analyzer breaks these sentences into a series of tokens, by removing any white space or comments in the source code.

In programming language, keywords, constants, identifiers, strings, numbers, operators and punctuations symbols can be considered as tokens.

If the lexical analyzer finds a token invalid, it generates an error.

The lexical analyzer works closely with the syntax analyzer. It reads character streams from the source code, checks for legal tokens, and passes the data to the syntax analyzer when it demands.

0 comments:

Post a Comment

Data Structures with C++



NET/SET/CS PG



Operating Systems



Computer Networks



JAVA



Design and Analysis of Algorithms



Programming in C++

Top