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.
Types of Compiler
There exists a wide variety of compilers. Some of the common types of compilers are:
- Hardware Compiler: A compiler that produces output due to hardware configuration. Example: Xilinx Synthesis Tool (XST)
- Cross Compiler: A compiler that can produce source code in one machine and execute it on the other machine. Example: GNU Compiler Collection (GCC).
- JIT Compiler: This compiler is applicable for advanced programming languages such as python and java.
- Source to Source Compiler: A compiler that transforms the source code of one language into the source code of the other language. Example: Haxe
Compiler Design Architecture
The Compiler Design Architecture is divided into two main phases, namely:
The diagrammatic representation for the Compiler Design Architecture is shown as:
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.
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
In this blog, we covered the basic concepts of Compiler along with its Types and Design Architecture.
- Difference Between Compiler and Assembler
- Intermediate Code Generation in Compiler Design
- Intermediate Code Generator
- Compiler Construction Tools
- Phases of A Compiler
- Basic Block In Compiler Design
- Code Optimization in Compiler Design
- Backpatching In Compiler Design
- Lexer and Lexer Generator
- Syntax Trees
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.