0% found this document useful (0 votes)
0 views9 pages

What Is A Compiler

A compiler is software that translates high-level programming languages into low-level machine code, enabling program execution on computers. The document outlines the phases of compilation, types of compilers, and their purposes, including self, cross, and just-in-time compilers. It emphasizes the importance of compiler design for efficient and accurate code translation.

Uploaded by

guptadevansh421
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views9 pages

What Is A Compiler

A compiler is software that translates high-level programming languages into low-level machine code, enabling program execution on computers. The document outlines the phases of compilation, types of compilers, and their purposes, including self, cross, and just-in-time compilers. It emphasizes the importance of compiler design for efficient and accurate code translation.

Uploaded by

guptadevansh421
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

What is a Compiler?

Definition Purpose

Software that translates high-level code to low-level code. Enables execution of programs on computers.
High-Level Languages Low-Level Languages Assembly Language

A programming language close to A language close to machine code, A low-level language using mnemonics
human language, easy to read and harder for humans to understand, but (short codes) to represent machine
write. directly interacts with hardware. instructions.

Examples: Python, Java, C++. Examples: Assembly language,


MOV A, B (moves data from
machine code.
B to A)

Requires an assembler to convert it into


machine code.
Compiler Design
Compiler Design is the process of creating a compiler, which translates high-level code into machine code. It focuses on the
phases of compilation (e.g., lexical analysis, syntax analysis, code generation), error handling, and optimization to ensure
efficient and accurate translation.
Phases of Compiler
Lexical Analysis 1
Tokenizes source code.

2 Syntax Analysis
Checks grammar, builds parse tree.

Semantic Analysis 3
Ensures meaningfulness, type checking.

4 Intermediate Code Generation


Translates to intermediate representation.

Code Optimization 5
Improves performance, efficiency.

6 Code Generation
Produces machine code or target language.

Code Linking 7
Combines code with libraries for execution.
Types of Compilers
Self Compiler Cross Compiler Source-to-Source Compiler
Runs and produces code for the Runs on one machine, produces Translates code from one language
same machine. code for another. to another.
Compiler Types: Continued
Single Pass Compiler Two Pass Compiler
All phases in one module. Two passes for translation.

Multi-Pass Compiler
Multiple passes for complex processing.
Just-in-Time (JIT) Compilers
1 Dynamic Compilation2 Performance
Optimization
Compiles code during
execution. Improves performance over
time.

3 Common in Virtual Machines


Used in Java, JavaScript, and other platforms.
Ahead-of-Time (AOT)
Compilers
1 Pre-Compilation 2 Faster Startup Times
Compiles code before Code is ready to run
execution. immediately.

3 Optimized Performance
Improved runtime performance.
Incremental Compilers
1 Compile Only 2 Faster Compilation
Changes
Reduces compilation time
Recompiles only modified during development.
code.

3 Improved Developer Workflow


Faster feedback loop for developers.

You might also like