Compiler Design 2023
Compiler Design 2023
A Govt. Aided UGC Autonomous & NAAC Accredited Institute, Affiliated To R.G.P.V Bhopal (M.P.), INDIA
Aditya Joshi
0901IT201002
Compiler Design
Proficiency Examination
Submitted To:- Prof.
Abhilash Sonkar
INTRODUCTION TO COMPILER DESIGN
• Compiler design is the process of creating software that can translate high-level programming
languages into machine code that can be executed by a computer.
• Finite Automata and Context Free Grammar are fundamental concepts in compiler design.
• The working of a compiler involves several components, including Lexical Analyzer, Syntax
Analyzer, Semantic Analyzer, Intermediate Code Generation, Code Optimization, and Code
Generation.
• Various parsing techniques, code generation and optimization techniques, and tools and techniques
are used for designing a compiler.
• In this presentation, we will examine each of these concepts in detail.
WORKING OF A COMPILER
• The Lexical Analyzer, also known as a Scanner, breaks down the source code into tokens, which are meaningful units of
code.
• The Syntax Analyzer, also known as a Parser, uses Context-Free Grammar to check the syntactical correctness of the
source code and creates an Abstract Syntax Tree (AST).
• The Semantic Analyzer checks the meaning of the source code using the AST and ensures that it is semantically correct.
• Intermediate Code Generation generates an intermediate representation of the source code that is independent of the
target machine.
• Code Optimization improves the performance of the generated code by reducing the number of instructions or the time
complexity.
• Code Generation translates the intermediate code into target machine code that can be executed by the computer.
PHASES OF A COMPILER:
PARSING TECHNIQUES AND COMPARISON
• Parsing is the process of analyzing the syntax of the source code and constructing an Abstract Syntax
Tree.
• Top-Down Parsing is a recursive descent parsing technique that starts at the root of the tree and works its
way down to the leaves.
• Bottom-Up Parsing is a shift-reduce parsing technique that starts at the leaves of the tree and works its
way up to the root.
• Comparison of parsing techniques based on factors such as time complexity and ease of implementation
can help to choose the appropriate parsing technique for a particular programming language.
• Popular programming languages like C, C++, and Java use different parsing techniques.
Thank you