MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In a compiler, keywords of a language are recognized during
A
Syntax analysis
B
Code generation
C
Lexical analysis
D
Data flow analysis
Explanation: 

Detailed explanation-1: -Typically, the lexical analysis phase of compilation breaks the input text up into sequences of lexemes that each belongs to some particular token type that’s useful in later analysis. Consequently, keywords are usually first recognized during lexical analysis in order to make parsing easier.

Detailed explanation-2: -Lexical analysis is the starting phase of the compiler. It gathers modified source code that is written in the form of sentences from the language preprocessor. The lexical analyzer is responsible for breaking these syntaxes into a series of tokens, by removing whitespace in the source code.

Detailed explanation-3: -Essentially, lexical analysis means grouping a stream of letters or sounds into sets of units that represent meaningful syntax. In linguistics, it is called parsing, and in computer science, it can be called parsing or tokenizing.

Detailed explanation-4: -Syntax Analysis: Basically, in the second phase, it analyses the syntactical structure and inspects if the given input is correct or not in terms of programming syntax. It accepts tokens as input and provides a parse tree as output. It is also known as parsing in a compiler. Note syntax errors.

Detailed explanation-5: -Explanation: Lexical analyser takes source program as input and token as output.

There is 1 question to complete.