List out various tasks performed by compiler in converting source code to object code.
CS Professional · Information Technology and Systems Audit · PYQS · December 2017
List out various tasks performed by compiler in converting source code to object code.
Answer & Explanation:
A compiler performs two major tasks: Analysis of the source program Synthesis of the target-language instructions The main tasks carried out by compilers are: Lexing: Break up the text of the program into 'tokens'. Tokens are the 'words' of the programming language, such as identifiers (keywords, variable names, function names, etc.) or operators (=, *, &, etc.). Parsing: Convert the sequence of tokens into a parse tree, which is a data structure representing various language constructs: type declarations, variable declarations, function definitions, loops, conditionals, expressions, etc. Optimization: Evaluate constant expressions, optimize away unused variables or unreachable code, unroll loops if possible, etc. Translate: Translate the parse tree into machine instructions.
Topics: Programming Concepts
Related Questions in this Topic
- Write short notes on the following: Flow Chart
- A housing society having 400 members pay the electricity bill at the following rates: No. of Units consumed Charges...
- Define Algorithm. Briefly explain the various control structures used in Algorithm.
- A company has appointed marketing professionals at a monthly salary of ₹50,000. At the time of their annual appraisal al...
- Write short notes on the following: Advantages of using Flow Charts