0
2.0kviews
Draw architecture of compilers which takes the source code in HLL, follows different phases and converts it to object code.(any 2)

(i) Pipe and Filter (ii) Layered architecture (iii) Blackboard style

Mumbai University > Computer engineering > Sem 7 > Software.

Marks: 10 M

Year: May 11

1 Answer
0
17views

Compilers: A language translator whose input is source code and output is machine code.

enter image description here

Phases of a compiler:

It consist of 2 phase

  1. Analysis phase
  2. Synthesis phase

Analysis phase is further divided into

  • Lexical Analysis
  • Syntax Analysis
  • Semantic Analysis

Synthesis phase is further divided into - Intermediate Code Generation - Code Optimization - Code Generation

Phase1: Lexical Analysis

enter image description here

Phase2: Syntax Analysis

enter image description here

Phase3: Semantic Analysis

enter image description here

Phase4: Intermediate Code Generation

enter image description here

Phase5: Code Optimization

enter image description here

Phase6: Code Generation

enter image description here

Pipe and Filter style

enter image description here

The above figure shows different stages of compiler in pipe and filter style. It is a partial pipe and filter style. Each component has a set of input and output. The source code in high level language is given to the first component which processes the input and generates a corresponding output. The output is carried to the next component by the connector, here pipes. Thus, after a series of processes the target code generated is given as output.

Layered architecture

enter image description here

The above figure shows different stages of compiler in layered architecture style. It is a partial layered architecture. Each layer offer services to other layers. Communication takes place between the layers with the help of connectors, here procedural calls. The compiler, at each phase connect to the symbol table and the tree to complete its processes and move further to the next phase. Finally, the target code is given as output.

Blackboard style

The figure below shows different stages of compiler in blackboard style. The blackboard consisting of the symbol table and tree and the individual phases of the compiler constitute the components. The connectors can be direct memory reference, database query and so on.

enter image description here

Please log in to add an answer.