skip to Main Content

Compiler Design & Construction Basic Concepts

Compiler Design & Construction Basic Concepts

Compiler Design & Construction Basic ConceptsDefinition of Compiler Design & Construction Basic Concepts – A compiler is a computer program which is used to convert high level language (Source code) into another program (target code), which are easily executable by computer machine. The target code is in the binary form which is executable by CPU of a Computer System. Alternatively, the compiler is designed to convert High level language into low level language (e.g. Assembly language or machine code). The conversion is required because the HLL language is not understandable or executable by computer operating system or CPU. The CPU processor only execute machine language code or binary codes. The compiler can also translate the high level source programs into target program in machine language for the specific hardware.

What is Cross Compiler?

The compiler that runs on one computer but produces object code for a different type of computer. Since the compiler program is working on computer-A but it is producing Object code for Computer-B. This type of compiler is called as Cross Compiler.

What is Decompiler?

The Program which translates low level languages into High level language is called as Decompiler. The computer program which takes an executable file as input and convert it into Source file (HLL), which can be compiled further. In reality the Decompiler are unable to reconstruct the original source code, there remains some obfuscated code.

What are the Types of Compiler?

There are many types of compiler being design according to the Application areas.

  1. Source to Source Compiler – The compiler which takes high level language as input and outputs a High level language after conversion. Ex – Automatic Parallelizing Compiler
  2. Hardware Compilers – The compiler output target computer hardware at a very low level. Such compilers are also called as hardware compilers because the source code they compile controls the final configuration of the hardware and how it operates. The output of these compilation shows an interconnection of transistors or lookup tables. Example – XST (Xilinx Synthesis Tool) is used to configure FPGAs.
  3. Bytecode Compilers – The compiler which compile source code into assembly language. Warren Abstract Machine (WAM), bytecode compiler for java and python are some examples.
  4. JIT (Just In Time) Compiler – It is the last part of a multi-pass compiler chain in which some compilation stages are deferred to run-time.
    Ex – Smalltalk, Microsoft .NETs CIL System.

What is Interpreter?

The interpreter is a computer program which executes directly instructions written in a program or scripting language without being previously compiled into machine language. The interpreter translate one statement at a time.

What are the difference between Interpreter and Compiler?

  1. Interpreter translates one statement at a time. But Compiler scans the entire program and translates it as a whole into machine code.
  2. Interpreter takes less amount of time to analyze the source code but the overall execution time is slower. But compiler takes large amount of time to analyze the source code but the overall execution time is comparatively faster.
  3. The interpreter translate the program until the first error is met. So debugging is easy. The Compiler It shows the error message only after scanning the whole program. So debugging is comparatively hard.
  4. Interpreter are used in language like Python, Ruby. In case of Compiler C, C++ Programming language use Compiler. Compiler Design & Construction Basic Concepts.

Leave a Reply

Back To Top
%d bloggers like this: