Compiler Design Tutorial: What is, Types, Tools, Example

What is a Compiler?

A compiler is a computer program which helps you transform source code written in a high-level language into low-level machine language. It translates the code written in one programming language to some other language without changing the meaning of the code. The compiler also makes the end code efficient which is optimized for execution time and memory space.

The compiling process includes basic translation mechanisms and error detection. Compiler process goes through lexical, syntax, and semantic analysis at the front end, and code generation and optimization at a back-end.

In this Compiler Design tutorial, you will learn

Features of Compilers

Types of Compiler

Following are the different types of Compiler:

Single Pass Compiler

Single Pass Compiler
Single Pass Compiler

In single pass Compiler source code directly transforms into machine code. For example, Pascal language.

Two Pass Compiler

Two Pass Compiler
Two Pass Compiler

Two pass Compiler is divided into two sections, viz.

  1. Front end: It maps legal code into Intermediate Representation (IR).
  2. Back end: It maps IR onto the target machine

The Two pass compiler method also simplifies the retargeting process. It also allows multiple front ends.

Multipass Compilers

Multipass Compilers
Multipass Compilers

The multipass compiler processes the source code or syntax tree of a program several times. It divided a large program into multiple small programs and process them. It develops multiple intermediate codes. All of these multipass take the output of the previous phase as an input. So it requires less memory. It is also known as 'Wide Compiler'.

Tasks of Compiler

Main tasks performed by the Compiler are:

History of Compiler

Important Landmark of Compiler's history are as follows:

Steps for Language processing systems

Before knowing about the concept of compilers, you first need to understand a few other tools which work with compilers.

Steps for Language processing systems
Steps for Language processing systems

Compiler Construction Tools

Compiler construction tools were introduced as computer-related technologies spread all over the world. They are also known as a compiler- compilers, compiler- generators or translator.

These tools use specific language or algorithm for specifying and implementing the component of the compiler. Following are the example of compiler construction tools.

Why use a Compiler?

Application of Compilers

Summary

 

YOU MIGHT LIKE: