Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
99 views2 pages

Compiler-Design-QB (Unit1 - 2)

This document is a question bank for the Compiler Design course at Galgotias College of Engineering and Technology, covering various topics related to compiler construction and design. It includes questions on finite automata, parsing techniques, grammar, and different types of compilers. The questions are organized into two units, addressing both theoretical concepts and practical applications in compiler design.

Uploaded by

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

Compiler-Design-QB (Unit1 - 2)

This document is a question bank for the Compiler Design course at Galgotias College of Engineering and Technology, covering various topics related to compiler construction and design. It includes questions on finite automata, parsing techniques, grammar, and different types of compilers. The questions are organized into two units, addressing both theoretical concepts and practical applications in compiler design.

Uploaded by

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

GALGOTIAS COLLEGE OF ENGINEERING

AND TECHNOLOGY
Knowledge Park-II, Greater Noida, U.P
Department of CSE & Allied Specialized Branches

Sub: Compiler Design Sem: VI Sub Code: BCS 602

Question Bank

# Unit 1

1. Build a FA that accepts the words baa, ab and abb and no other string shorter or longer.
2. Define LEX and YACC.
3. Explain three address code, Quadruples and triples.
4. Write Quadruples, triples and indirect triples for expression (x+y)*(y+z)+(x+y+z).
5. Discuss Backus-Naur-Form in details
6. Explain in detail the process of compilation. Illustrate the output of each phase of
compilation of the input “a=(b+c)*(b+c)*2”.
7. Construct the minimized DFA for the regular expression (0+1)*(0+1) 10
8. What is different type of passes and their advantages.
9. Explain Bootstrapping and Cross Compiler?
10. What is Ambiguous Grammar explain with Example?
11. Differentiate between parse tree and syntax tree.
12. Construct NFA for regular expression (a+b)*abb
13.What is the use of DFA in lexical analysis.
14. Define CFG and write a CFG for regular expression r= (a+b)* aa (a+b)*
15. Eliminate null production from the grammar S→ a|Xb|aYa, X→Y| null, Y→ b|X.
16. Write a short note on:
a. YACC
b. Pass
c. Bootstrapping
d. LEX Compiler
e. Tokens, Patterns and Lexemes
17. Derivation and Parse Tree: Let G be a Context Free Grammar for which the production
Rules are given below: S -> aB|bA, A -> a|aS|bAA B -> b|bS|aBB.
Drive the string aaabbabbba using the above grammar (using Left Most Derivation and Right
most Derivation).
18. Write the comparison among SLR Parser, LALR parser and Canonical LR Parser.
19. Write the steps to convert Non-Deterministic Finite Automata (NDFA) into Deterministic
Finite Automata (DFA).
20. Symbol table is necessary for compiler construction, justify the statement with example.
21. Find the minimal DFA’s for the following: a.) L= { a^n b^m: n=>2, m=> 1}
22. Build an FA that accepts ba, abb and aab strings only.
23. Discuss the problem or challenges faced by lexical analyser.
24. Consider the grammar s→ aSbS|bSaS|null
a.) show grammar is ambiguous.
b.) Construct the RMD for “abab”
c.) Construct a parse tree for “abab”
25. Define Chomsky hierarchy in details.
# Unit 2

1.Construct LR(1) parsing table for given grammar:


S->AA, A->aA/b
2.Remove the left recursion from the grammar:
E-> E (T) | T, T -> T (F) | F, F-> id
3.What is operator precedence grammar? Compute the operator precedence table for the
given grammar:
E-> E+T\T, T-> T+F\F, F-> (E) | id
4. Explain how stack implementation of shift reduce parsing is done, considering the grammar:
E-> E+E, E-> E*E, E-> (E), E-> id and the input string as id1+id2*id3
5. Calculate the first and follow for the grammar: S→ A, A→aB|Ad, B→bBClf, C→g.
6. State any two reasons as to why phases of compiler should be grouped.
7. Explain the symbol table and error handler phase of compiler.
8. Construct the unambiguous Grammar of:
R-> R+R| R*R|a|b|c
9. Differentiate between syntax trees and parse tree with example.
10. Justify the statement “LALR(1) (Look-Ahead LR) Parsing is an optimized version of
CLR(1) (Canonical LR(1))”.
11. Explain Top-Down parsing. What are the problems in top-down parsing. Explain any one
issue with suitable example.
12. Discuss the algorithm for construction of SLR parsing table.
13. Construct the LALR parsing table for grammar: S→AA, A→ aA|b.
14. Obtain the canonical collection of set of LR (1) items for following grammar: S→SB|Ca,
B→Bb|null, C→aB|c.
15. Give a comparison of Predictive parser with shift reduce parser.
16. Compare and contrast LR and LL Parsers.
17. Define augmented grammar
18. Discuss various data structure used for symbol table with suitable example.
19. Explain Left Recursion, Left Factoring with example?
20. Explain Recursive Decent Parser with example?
21. Write Rules to construct FIRST Function and FOLLOW Function.
22. Check whether the following grammar is SLR (1) or not. Explain your answer with
Reasons. S→ L=R, S→R, L→*R, L→id, R→L
23. Construct SLR parse table for S->L=R/R, R->L, L->*R/id
24. Construct an LALR Parsing table for the following grammar: E-> E+T |T, T-> T*F|F, F-
>id
25.Explain limitation of LR(0) and SLR parser.

You might also like