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

CD - Assignment 1

Uploaded by

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

CD - Assignment 1

Uploaded by

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

Compiler Design (3170701)

Assignment 1

1. Explain Error and its types.

2. Explain different phases of compiler

3. Define lexeme, token and pattern. Identify the lexemes that make up the tokens in the
following program segment. Indicate corresponding token and pattern.

4. Construct DFA for following Regular expression. Use firstpos, lastpos and followpos
functions to construct DFA.

(a*|b*)*

5. What is regular expression, give all the algebraic properties of regular expression.

6. Construct NFA for following regular expression using Thompson’s notation and then
convert it into DFA.

a(b | c)*a*c#

7. Construct NFA for following Regular Expression using Thomson’s Construction.

Apply subset construction method to convert into DFA.

(a | b)*abb

8. Construct DFA by syntax tree construction

method. a+ b* (c |d) f #

Optimize the resultant DFA.


9. Explain linker & loader.

10. Compare top-down and bottom-up parser.

11. Explain right-most-derivation-in-reverse with the help of an example.

12. Explain SLR parser. How is its parse table constructed?

13. Explain Error recovery strategies using suitable examples.

14. Consider the grammar

S -> SS+ | SS* | a

Show that the string aa+a* can be generated by the grammar. Construct the parse tree
for the grammar. Is the grammar ambiguous?

Write unambiguous production rules for if then else construct.

15. Apply shift reduce parser for parsing following string using unambiguous

grammar. id - id * id - id

16. Where do we use operator precedence parsing technique? Give the general precedence
table for operating precedence parsing, considering all the generalized rules.
17. Construct a precedence graph, precedence table for operator precedence parser to be
used for parsing a string consisting of id, - , * , $. Parse following string.

$ id - id * id * id $

18. What is left recursion? Eliminate the left recursion from the following grammar.

And Design the FIRST SET and FOLLOW SET for the following grammar

E◊E+T|T

T◊T*F|F

F ◊ ( E ) | id

19. Explain left factoring with the help of an example.

20. Differentiate SLR, Canonical LR and LALR. Also justify the statement “A class of grammar
that can be parsed using LR methods is a proper subset of the class of grammars that
can be parsed with predictive parser”.

21. Draw the state transition diagram for the unsigned numbers.

Subject Teacher H.O.D

Ms. Nensi Panchal Mrs. Ridhdhi Naik

You might also like