SYNTAX ANALYSIS
ROLE OF THE PARSER
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Analysis phase
|
|
Synthesis phase
|
|
Both
|
|
None of the above
|
Detailed explanation-1: -The Analysis stage of a compiler is machine-independent and language-dependent, while the synthesis stage is machine-dependent and language-independent.
Detailed explanation-2: -The synthesis phase is concerned with the construction of target language statements which have the same meaning as a source statement. Typically this consist of two main activities: Creation of data structure in the target program. Generation of target code.
Detailed explanation-3: -There are 6 phases in the compiler, namely, lexical analysis, syntax analysis, semantics analysis, intermediate code generation, code optimization, and code generation. Symbol table is a data structure that the compiler generates and maintains to keep track of the semantics of variables.
Detailed explanation-4: -4. Intermediate Code Generation: The parse tree is semantically confirmed; now, an intermediate code generator develops three address codes. A middle-level language code generated by a compiler at the time of the translation of a source program into the object code is known as intermediate code or text.
Detailed explanation-5: -There are two main phases in the compiler. 1. Analysis-Front end of a compiler. 2. Synthesis-Back end of a compiler.