Wednesday, March 23, 2016

Using suitable block diagram shows the different phases of a compiler & briefly describes the phases.


A compiler operates in phases, each of which transform the source program from one representation to another. Generally, these are six types of phases in compiler. These are -

  • Lexical Analysis
  • Syntax Analysis
  • Semantic Analysis
  • Intermediate code generation
  • Code Optimization
  • Code Generation

Lexical Analysis : Linear Analysis  is called lexical analysis or scanning. Linear analysis reads the character in the source program & groups them into tokens in which each token represents a logically cohesive sequence of characters such as identifier. A key words(if, while etc.). A punctuation character or multi-character operator like : =.

Syntax Analysis : Hierarchical analysis is called syntax analysis or parsing. in the syntax analysis, the character or tokens are grouped hierarchically into nested collection with collective meaning.

Semantic Analysis :  The semantic analysis phase checks the source program for semantic errors & gathers type information for the sub-sequent code generation phase. It uses the hierarchical structure determined by the syntax - analysis phase to identify the operators & operands of expression & statements. An important component of semantic analysis is type checking. 

Intermediate Code Generation : After syntax & semantic analysis the compiler generates an explicit intermediate representation of the source program. This, intermediate representation as a program for an abstract machine. It have two properties -
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

Related Posts:

0 comments:

Post a Comment