INTRODUCTION TO COMPILER DESIGN
COMPILATION PROCESS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
There are 4 main stages of compilation. Semantic analysis is
|
Comments and unneeded spaces are removed. Remaining code is turned in to tokend and. A symbol table is created which holds the addresses of variables, labels and subroutines.
|
|
Tokens are checked to see if they match the spelling and grammar expected. This is done by parsing each token to determine if it uses the correct syntax for the programming language. If syntax errors are found, error messages are produced.
|
|
Variables are checked to ensure that they have been properly declared, used and are the correct data type. Operations are checked to ensure that they are legal for the type of variable being used, e.g. you would not try to store the result of a division operation as an integer.
|
|
Machine code is generated. Code optimisation to run as fast as possible. redundant data is removed.
|
Explanation:
Detailed explanation-1: -Explore the Phases of Compiler Lexical Analysis. Syntactic Analysis or Parsing. Semantic Analysis. Intermediate Code Generation.
Detailed explanation-2: -The grammar of the programming is checked at Syntax analysis phase of the compiler.
There is 1 question to complete.