(SEM V ) THEORY EXAMINATION 2021-22 COMPILER DESIGN

B.Tech Engineering 0 downloads
₹29.00

B.Tech (Sem V) – Theory Notes & Exam Answers

SECTION A – Short Answer Type


a. Parse Tree vs Abstract Syntax Tree (AST)
A parse tree shows the complete grammatical structure of the source program including all grammar symbols, while an AST is a simplified version that removes unnecessary grammar details and represents the essential structure.


b. Problems with Top-Down Parser
Top-down parsers cannot handle left recursion, require grammar transformations like left factoring, and may face backtracking issues.


c. Errors in Compilation Process
Lexical errors, syntactic errors, semantic errors, runtime errors, and logical errors may occur during compilation.


d. Types of Attributes
Two types of attributes are synthesized attributes and inherited attributes, used in syntax-directed translation.


e. Language Translator and Compiler
A language translator converts code from one language to another. A compiler translates high-level language into machine code.


f. Hashing
Hashing is a technique used to store and retrieve data efficiently using a hash function, commonly used in symbol tables.


g. Left Factoring
Left factoring removes common prefixes in grammar productions to make them suitable for predictive parsing.


h. Left Recursion
A grammar is left recursive if a non-terminal derives itself as the leftmost symbol.
Given grammar:
E → E+E | E*E | a | b
Yes, it is left recursive.


i. Ambiguous Grammar
A grammar is ambiguous if it produces more than one parse tree for the same string.
Example:
E → E+E | id


j. Shift-Reduce Conflicts
Shift-reduce conflict and reduce-reduce conflict occur during bottom-up parsing.


SECTION B – Descriptive Answers


Activation Record & Runtime Storage

An activation record stores information about a function call such as parameters, return address, local variables, and temporaries. It plays a key role in runtime storage management.

Intermediate Code Representation

For expression:
(x + y)*(y + z) + (x + y + z)
Intermediate representations include quadruples, triples, and indirect triples, which help in optimization and code generation.


Basic Block, Flow Graph & Next Use

A basic block is a sequence of instructions with single entry and exit.
A flow graph represents control flow among basic blocks.
Next-use information helps in register allocation.

Predictive Parsing

Predictive parsing uses FIRST and FOLLOW sets to build a parse table and avoids backtracking.


SECTION C – Long Answer Type


SLR Parsing Table

SLR parser uses LR(0) items and FOLLOW sets to build parsing tables. It is simpler but less powerful than LALR and CLR parsers.

 

Stack vs Heap Allocation

Stack allocation is fast and uses LIFO order, while heap allocation is flexible but slower and used for dynamic memory.
 

Syntax Directed Definition

SDD associates grammar rules with semantic rules to generate intermediate code.
 

DAG & Peephole Optimization

DAG removes redundant computations in basic blocks.
Peephole optimization improves code by eliminating inefficient instruction patterns.
 

Lexical & Syntactic Errors

Lexical errors occur during tokenization, while syntactic errors occur due to grammar violations. Error recovery includes panic mode and phrase-level recovery.
 

Induction Variable Optimization

Induction variables change linearly in loops and can be optimized to reduce repeated calculations.
 

LL(1) Grammar Test

A grammar is LL(1) if parsing table has no conflicts. FIRST and FOLLOW sets are used for testing.
 

Static vs Dynamic Scope

Static scope is determined at compile time, while dynamic scope is decided at runtime.
 

Code Generator Issues

Instruction selection, register allocation, and instruction scheduling are major design issues.
 

Three Address Code

Three address code represents control structures using labels, jumps, and temporary variables.

File Size
158.86 KB
Uploader
SuGanta International
⭐ Elite Educators Network

Meet Our Exceptional Teachers

Discover passionate educators who inspire, motivate, and transform learning experiences with their expertise and dedication

KISHAN KUMAR DUBEY

KISHAN KUMAR DUBEY

Sant Ravidas Nagar Bhadohi, Uttar Pradesh , Babusarai Market , 221314
5 Years
Years
₹10000+
Monthly
₹201-300
Per Hour

This is Kishan Kumar Dubey. I have done my schooling from CBSE, graduation from CSJMU, post graduati...

Swethavyas bakka

Swethavyas bakka

Hyderabad, Telangana , 500044
10 Years
Years
₹10000+
Monthly
₹501-600
Per Hour

I have 10+ years of experience in teaching maths physics and chemistry for 10th 11th 12th and interm...

Vijaya Lakshmi

Vijaya Lakshmi

Hyderabad, Telangana , New Nallakunta , 500044
30+ Years
Years
₹9001-10000
Monthly
₹501-600
Per Hour

I am an experienced teacher ,worked with many reputed institutions Mount Carmel Convent , Chandrapu...

Shifna sherin F

Shifna sherin F

Gudalur, Tamilnadu , Gudalur , 643212
5 Years
Years
₹6001-7000
Monthly
₹401-500
Per Hour

Hi, I’m Shifna Sherin! I believe that every student has the potential to excel in Math with the righ...

Divyank Gautam

Divyank Gautam

Pune, Maharashtra , Kothrud , 411052
3 Years
Years
Not Specified
Monthly
Not Specified
Per Hour

An IIT graduate having 8 years of experience teaching Maths. Passionate to understand student proble...

Explore Tutors In Your Location

Discover expert tutors in popular areas across India

Resume & Interview Coaching Near By Dwarka Mor Build a Professional Resume, Crack Interviews & Secure Your Dream Job Dwarka Mor, Delhi
Prenatal Yoga Training Near Sector 121 Noida – A Complete Guide for Healthy Pregnancy and Wellness Noida
TOEFL Coaching Near Sector 58 Gurugram – Expert Preparation for High Scores Gurugram
UI/UX Designing Classes Near By Kirti Nagar – Build a Creative Tech Career Kirti Nagar, Delhi
Fitness Training Near By Najafgarh Professional Workout Programs for Strength, Weight Loss & Overall Wellness Najafgarh, Delhi
TOEFL Coaching Near Noida Sector 106 – Complete Guide for Students Preparing to Study Abroad Noida
Spoken English Classes Near By Malviya Nagar Build Confidence, Improve Fluency & Unlock Career Opportunities in 2026 Malviya Nagar, Delhi
Spoken English Classes Near Sector 107 Gurugram (Dwarka Expressway) – Speak Fluently, Communicate Confidently Sector 107, Gurugram
History Classes Near Sector 91 Gurugram – Build Strong Understanding of the Past for a Better Future Gurugram
Guitar Classes Near By Lajpat Nagar Learn Guitar with Expert Trainers & Turn Your Passion into a Powerful Skill Lajpat Nagar, Delhi
Diet & Nutrition Consultation Near Sector 127 Noida – A Complete Guide to Healthy Living Noida
Financial Advisory Near By Dwarka Mor Professional Financial Planning, Investment Guidance & Wealth Management Support Dwarka Mor, Delhi
SEO Training Near Sector 63 Gurugram – Master Search Engine Optimization & Build a High-Growth Career Sector 63, Gurugram
Physiotherapy Guidance (Certified Professionals Only) Near Sector 122 Noida – Complete Support for Pain Relief and Physical Recovery Sector 122, Noida
High Profit Margin Business Opportunities Near Sector 109 Gurugram (Dwarka Expressway) Gurugram
Graphic Designing Classes Near Noida Sector 97 – Learn Creative Design Skills and Build Your Career Sector 97, Noida
Zumba Classes Near Palam Vihar Extension – Dance Your Way to Fitness New Palam Vihar, Gurugram
Spoken English Classes Near By Govindpuri Improve Fluency, Build Confidence & Unlock Better Career Opportunities in 2026 Govindpuri, Delhi
Study Abroad Consultation Near Sector 101 Dwarka Expressway, Gurugram – Your Gateway to Global Education Gurugram
Spanish Language Classes Near Uttam Nagar – Learn Spanish with Confidence Uttam Nagar, Delhi
⭐ Premium Institute Network

Discover Elite Educational Institutes

Connect with top-tier educational institutions offering world-class learning experiences, expert faculty, and innovative teaching methodologies

Réussi Academy of languages

sugandha mishra

Réussi Academy of languages
Madhya pradesh, Indore, G...

Details

Coaching Center
Private
Est. 2021-Present

Sugandha Mishra is the Founder Director of Réussi Academy of Languages, a premie...

IGS Institute

Pranav Shivhare

IGS Institute
Uttar Pradesh, Noida, Sec...

Details

Coaching Center
Private
Est. 2011-2020

Institute For Government Services

Krishna home tutor

Krishna Home tutor

Krishna home tutor
New Delhi, New Delhi, 110...

Details

School
Private
Est. 2001-2010

Krishna home tutor provide tutors for all subjects & classes since 2001

Edustunt Tuition Centre

Lakhwinder Singh

Edustunt Tuition Centre
Punjab, Hoshiarpur, 14453...

Details

Coaching Center
Private
Est. 2021-Present
Great success tuition & tutor

Ginni Sahdev

Great success tuition & tutor
Delhi, Delhi, Raja park,...

Details

Coaching Center
Private
Est. 2011-2020