Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Compiler Design: Lexical Analysis and Parsing, Exercises of Compiler Design

The fundamental concepts of compiler design, focusing on the lexical analysis and parsing phases. It provides a detailed explanation of language processing systems, the role of lexical analyzers, the specification of tokens, and the different types of finite automata. The document also delves into the challenges and techniques of top-down and bottom-up parsing, including recursive descent parsing, ll(1) parsing, and lr parsing. It covers topics such as left recursion, left factoring, first and follow sets, predictive parsing tables, and error recovery in parsing. This comprehensive coverage of lexical analysis and parsing makes this document a valuable resource for students and researchers interested in understanding the inner workings of compilers.

Typology: Exercises

2023/2024

Available from 09/25/2024

kundana-chetlapalli
kundana-chetlapalli 🇮🇳

7 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
UNIT-1
1)a)Explain about Language processing system in detail. [6M][L2]
b)what is the role of lexical analyzer and Explain briefly.[4M][L2]
2)a)Explain about Specifications of Tokens.[5M][L3]
b)What is Bootstrapping? Explain briefly about bootstrapping. [5M][L1]
3)a)Demonstrate the role of lexical analyzer .[5M][L2]
b)What is Finite Automata? Explain different types of Finite Automata. [5M][L1]
4)a)Explain detail about Input Buffering Technique. [5M][L3]
b)Explain about DFA and NFA one example for conversion of NFA to DFA conversion. [5M][L2]
5)Explain in detail about the phases of compilers . [10M][L2]
6)a)Explain the role of lexical analyzer .[5M][L2]
b)Explain in detail about Input buffering. [5M][L2]
7)a)Explain in detail about Input buffering. [5M][L2]
b)Explain the structure of Lexical Analyzer Generator. [5M][L1]
8) Explain detail about Recognition of tokens and their examples. [10M][L2]
9)a)What is the use of Regular definition in specification of tokens. [5M][L1]
b)Define Token,Attribute,Lexeme. [5M][L1]
10) a)What is LEX? Explain detail about general format of LEX program. [6M][L1]
b)Explain about structure of LEX. [4M][L1]
UNIT-II
1)a) Explain the role of a parser. [5M][L2]
b) consider the grammar given below
E ->E+E | E*E | E-E | a |b obtain leftmost right derivations and their parse trees for the
string “a+b*a+b”. [5M][L3]
2)Explain the problems in top down parsing. [10M] [L2]
3)a) What is left recursion and left factoring? Explain with an example. [5M][L1]
b) Compute First and Follow for the grammar E->E+T/T, T->T*F/F, F-> (E)/id. [5M][L2]
4) a) Illustrate recursive descent parser for the grammar. [5M][L2]
pf3

Partial preview of the text

Download Compiler Design: Lexical Analysis and Parsing and more Exercises Compiler Design in PDF only on Docsity!

UNIT- 1

1)a)Explain about Language processing system in detail. [6M] [L2] b)what is the role of lexical analyzer and Explain briefly.[4M] [L2] 2)a)Explain about Specifications of Tokens.[5M] [L3] b)What is Bootstrapping? Explain briefly about bootstrapping. [5M] [L1] 3)a)Demonstrate the role of lexical analyzer .[5M] [L2] b)What is Finite Automata? Explain different types of Finite Automata. [5M] [L1] 4)a)Explain detail about Input Buffering Technique. [ 5 M] [L3] b)Explain about DFA and NFA one example for conversion of NFA to DFA conversion. [5M] [L2] 5)Explain in detail about the phases of compilers. [10M] [L2] 6)a)Explain the role of lexical analyzer .[5M] [L2] b)Explain in detail about Input buffering. [5M] [L2] 7)a)Explain in detail about Input buffering. [5M] [L2] b)Explain the structure of Lexical Analyzer Generator. [5M] [L1] 8 ) Explain detail about Recognition of tokens and their examples. [10M] [L2] 9)a)What is the use of Regular definition in specification of tokens. [5M] [L1] b)Define Token,Attribute,Lexeme. [5M] [L1] 10 ) a)What is LEX? Explain detail about general format of LEX program. [6M] [L1] b)Explain about structure of LEX. [4M] [L1] UNIT-II 1)a) Explain the role of a parser. [5M] [L2] b) consider the grammar given below E - >E+E | EE | E-E | a |b obtain leftmost right derivations and their parse trees for the string “a+ba+b”. [5M] [L3] 2)Explain the problems in top down parsing. [10M] [L2] 3)a) What is left recursion and left factoring? Explain with an example. [ 5 M] [L1] b) Compute First and Follow for the grammar E->E+T/T, T->TF/F, F-> (E)/id*. [5M] [L2]

  1. a) Illustrate recursive descent parser for the grammar. [ 5 M] [L2]

S - >cAd A - >ab|a with a string cad b) Construct the LL ( 1 ) for the following grammar [5M] [L3] S – >(L) | a L – >L, S | S 5) Construct predictive parsing table for the grammar [10M] [L3] E - >E + T | T T - >TF | F F - >F | a |b* 6 ) a)What are the limitations of recursive descent parsers. [ 5 M] [L3] b) Explain in brief about the shift reduce parser with example. [5M] [L2] 7 )a) Explain the role of a parser. [5M] [L2] b) Construct the predictive parse table for the given grammar. [5M] [L3] E - > E+E E - > EE E* - > E-E E - > (E) | id. 8)What is recursive descent parser? Construct a recursive descent parser for the following grammar. E - > E+T | T T - > TF | F F* - > (E) | id. [10M] [L1] 9 ) Construct Predictive parsing table for the grammar [10M] [L3] E - >E + T | T T - >TF | F F - >F | a |b* 10 ) Explain about error recovery in predictive parsing. [10M] [L1] UNIT-III 1)Construct the CLR parsing table for the following grammar: [10M] [L3] *S->L=R | R L-> R | id R->L