Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

2101_PCCS501_SAPTARSHI MAJI

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 7

INTRODUCTION TO

COMPILER AND ITS


COUSINS
“Understanding the Basics of Compilers,
Interpreters, and Assemblers"

presented by:
Saptarshi Maji
WHAT IS A
COMPILER?
 Definition: A compiler is a program that
translates high-level source code written
in a programming language into machine
code, bytecode, or another programming
language.
 Purpose: To transform code so that it can
be executed by a computer.
 Process: Source Code → Compiler → Machine
Code
 Example Languages: C, C++, Java
PHASES OF A
COMPILER
 Lexical Analysis: Tokenizes the source code.
 Syntax Analysis: Parses tokens to create a syntax
tree.
 Semantic Analysis: Checks for semantic errors.
 Intermediate Code Generation: Produces an
intermediate code.
 Optimization: Enhances the intermediate code for
performance.
 Code Generation: Converts intermediate code to
machine code.
 Code Linking and Assembly: Links code modules and
converts to final machine code.
INTERPRETERS
 Definition: An interpreter directly executes
instructions written in a programming or
scripting language without previously
converting them to machine code.
 Process: Source Code → Interpreter →
Execution
 Advantages: Easier to debug, no need for
separate compilation.
 Disadvantages: Slower execution compared to
compiled code.
 Example Languages: Python, Ruby, JavaScript
ASSEMBLERS
 Definition: An assembler converts
assembly language, a low-level
human-readable code, into machine
code.
 Process: Assembly Code → Assembler
→ Machine Code
 Role: Used in systems programming
and for performance-critical
applications.
 Example: x86 Assembly Language
COMPARISON AND
CONCLUSION
 Compilers vs Interpreters:
• Compilers: Translate entire code before
execution, generally faster execution.
• Interpreters: Translate code on the fly, easier
for debugging.
• Assemblers: Specialized for low-level code
conversion.
 Conclusion: Each tool has its unique role and
is chosen based on the needs of the
application and development process.
THANK YOU

You might also like