COMPILER DESIGN 2018 MCA 4th Sem AKTU

Printed Pages: 1 Sub Code: RCA404

Paper Id: 214432 Roll No. _____________________

MCA

(SEM IV) THEORY EXAMINATION 2017-18

COMPILER DESIGN

Time: 3 Hours Total Marks: 70

Note: Attempt all Sections. If require any missing data; then choose suitably.

SECTION A

1. Attempt all questions in brief. 2 x 7 = 14

  1. What are the two parts of compilation? Explain briefly.
  2. Define symbol table.
  3. List the phases that constitute the front end of a computer.
  4. Differentiate tokens, patterns, lexeme.
  5. List the various error recovery strategies for a lexical analysis.
  6. Briefly explain the concept of derivation.
  7. Mention the types of LR parser.

SECTION B

2. Attempt any three of the following: 7 x 3 = 21

  1. What is translator? Differentiate between compilation and interpretation.
  2. Define DFA. Write an algorithm to convert NFA to DFA.
  3. Check whether the following gammar is LL(1) grammar or not
S \longrightarrow iEtSS' /a
    S \longrightarrow eS/\varepsilon
    1. E \longrightarrow b
  1. Make left and right derivation using top-down parsing to drive a statement:

W = id + \left(id\right) + id \ast id using following grammar:

E \longrightarrow E + E E \longrightarrow E \ast E E \longrightarrow \left( E \right) E \longrightarrow id Check whether the grammar is ambiguous for above statement.

  1. Explain the working and algorithm of LR parsers.

SECTION C

3. Attempt any one part of the following: 7 x 1 = 7

  1. What is syntax directed translation schemes? Explain how they are used to make syntax trees.
  2. Create three address code for the following expression:
a + a \ast \left( b - c \right) \ast d

4. Attempt any one part of the following: 7 x 1 = 7

  1. Define bootstrapping with the help of an example.
  2. What do you mean by operator precedence grammar? Computer the operator precedence table for the given grammar.
E \longrightarrow E + T/T
    T \longrightarrow T \ast F/F
    F \longrightarrow \left( E \right) /id

5. Attempt any one part of the following: 7 x 1 = 7

  1. Define syntax directed translation. Write the syntax directed translation for simple desk calculator and give annotated parse tree of the expression (7-2)*(8-1).
  2. Explain any two syntax directed translation schemes.

6. Attempt any one part of the following: 7 x 1 = 7

  1. What are different issues in code optimization? Explain it with proper example.
  2. With the help of diagram explain the various phases of compiler and explain its functioning.

7. Attempt any one part of the following: 7 x 1 = 7

  1. Explain the problems associated with top-down parsing.
  2. Write short notes on:

            i. Panic mode

           ii. Peephole optimization

Thank You!

Lokesh Kumar

Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.