Compiler Design (BCS613C) Solved Model Question Paper

Compiler Design (BCS613C) Solved Model Question Paper with Answers

Module – 1

1 ]a. What is a Compiler? Explain the working of a Compiler with your own example?

b List and explain applications of Compiler design.

c Write a note on productivity tools.

OR

2 ]a Consider the context-free grammar. S -> SS+ | SS* | a
i)Show how the string aa+a* can be generated by this grammar.
ii)Construct a parse tree for this string


b With a neat diagram explain Language processing system.

c Write a short note on Interpreter.


Module – 2

3] a Explain tokens, patterns, and lexemes. Demonstrate the same with examples.

b Discuss different types of common programming errors.

c Write and Apply an algorithm to eliminate left recursion from following grammar.

OR

4] a Write the transition diagram that recognizes the lexemes matching the token Relation Operator(relop) and identifiers.

b. Discuss different error recovery strategies.

c Eliminate left recursion from the given grammar
E->E+A | A
A->A B | B
B->B # | C
C->a | b


Module – 3

Q.5 a Is the grammar G = { S->L=R, S->R, R->L, L->*R | id } an LL(1) grammar?

Q.5 b Explain recursive descent parsing with example.

Q.5 c Explain shift reduce parsing technique with example.

OR

Q.6 a Show that the following grammar is LL(1).


Q.6 b Write the procedure to compute first and follow of the given grammar.

Q.6 c Explain handle pruning with example.


Module – 4

Q.7 a Show that the following grammar is SLR(1).


Q.7 b What is dependency graph? Write dependency graph for the expression 3 * 5 with suitable top down grammar.

OR

Q.8 a Construct LR(0) items and parsing table for the following grammar.


Q.8 b Write SDD for simple type declarations. Also write dependency graph for a declaration int id1,id2,id3.


Module – 5

Q.9 a Write a list of the common three address instruction forms with example.

b Write a note on the following
(i) Input to the code generator
(ii) The target program

OR

Q.10 a Write SDD for flow of control statements.

b Write a note on a simple target machine model.

3 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *