Table of contents
1.
Introduction
2.
Types of Compiler
3.
Compiler Design Architecture
3.1.
Analysis
3.2.
Synthesis
4.
Frequently Asked Questions
4.1.
What is a compiler?
4.2.
What is syntax analysis?
4.3.
What is a cross-compiler?
4.4.
What is the full form of YACC?
4.5.
What are the two parts of compiler design architecture?
5.
Conclusion
Last Updated: Mar 27, 2024

Compiler

Author Prachi Singh
4 upvotes
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?
Compiler Design

Introduction

The compiler works like a computer program used for transforming high-level language into a low-level language without modifying the meaning of a program.

In other words, it acts as an intermediate between machine-readable code and human-understandable language. The various operations that the compiler can perform are lexical analysis, semantic analysis, parsing, etc. The multiple operations consist of different inputs and outputs.

Also See, Specifications of Tokens in Compiler Design

Types of Compiler

There exists a wide variety of compilers. Some of the common types of compilers are:
 

  1. Hardware Compiler: A compiler that produces output due to hardware configuration. Example: Xilinx Synthesis Tool (XST)
  2. Cross Compiler: A compiler that can produce source code in one machine and execute it on the other machine. Example: GNU Compiler Collection (GCC).
  3. JIT Compiler: This compiler is applicable for advanced programming languages such as python and java.
  4. Source to Source Compiler: A compiler that transforms the source code of one language into the source code of the other language. Example: Haxe

Also See, Symbol Table Operations and  cousins of compiler

Compiler Design Architecture

The Compiler Design Architecture is divided into two main phases, namely:

  1. Analysis
  2. Synthesis

The diagrammatic representation for the Compiler Design Architecture is shown as:
 

Compiler Desgin Architecture

Analysis

This part mentions the front end of compiler design architecture. The various operations included in the phase are predicting the source code, dividing source code into multiple sections, and error analysis.

An intermediate program is taken into consideration as an output of this phase which is further sent for the synthesis scenario.

The various analysis phases are semantic analysis, syntax analysis, and lexical analysis.

Synthesis

This part mentions the back end of compiler design architecture. An intermediate program generated in the analysis phase is used as input for this particular phase.

The various synthesis phases are code generation and optimization.

Also see,  Cross Compiler

Frequently Asked Questions

What is a compiler?

A computer program that converts high-level language into low-level language is called a compiler.

What is syntax analysis?

The phase in which the compiler checks the grammar of the programming.

What is a cross-compiler?

A compiler that produces source code on one machine and executes it on the other machine.

What is the full form of YACC?

Yet Another Compiler Compiler

What are the two parts of compiler design architecture?

Analysis and synthesis

Conclusion

In this blog, we covered the basic concepts of Compiler along with its Types and Design Architecture.

Recommended Reading:

Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, Uber, Microsoft, etc. on Coding Ninjas Studio.

Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, DBMS, System Design, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.

Cheers!

Live masterclass