CD QUESTIONS(1,2,3).doc
Short Description
Download CD QUESTIONS(1,2,3).doc...
Description
1. a) Write a regular expression for identifiers and reserved words. Design the transition diagrams for them. 2. b) Explain the three general approaches for the implementation of a Lexical analyzer. c) Compare compiler and interpreter with suitable diagrams. 3. a) Why lexical and syntax analyzer are separated out? b) Construct the predictive parser for the following grammar S -> (L) | a L ->L,S | S c) Give the classification of parsing techniques and briefly explain each. 4. a) Parse the input string int id,id; using shift-reduce parser for the grammar S -> TL; T -> int | float L -> L,id | id 5. b) Write the steps for the efficient construction of LALR parsing table. Explain with an example. 6. a) Write regular expressions for the set of words having a,e,I,o,u appearing in that order, although not necessarily consecutively. b) Construct NFA equivalent to regular expression r= (a + b)*ab. c) Give general format for LEX program. 7. a) Show that the grammar S -> 0S1| SS | e is ambiguous. b) Explain the Non-Recursive predictive parsing with an example. c) What are the limitations of recursive descent parser? 8. a) Write the steps for the construction of CLR parsing table. b) Explain the compaction of LR parsing tables with an example. 9. a) State the reasons for separating Lexical analysis and Syntax analysis b) Describe the lexical errors and various error recovery strategies with suitable examples. c) Write a regular expression for relation operators. Design a transition diagram for them. 10. a) What is left recursion and left factoring? b) Verify whether the following grammar is LL(1) or not? E -> E + T | T T -> T* F / F F -> (F)|a|b. c) Discuss about error recovery strategies in predictive parsing. 11. a) Construct the collection of LR(0) item sets and draw the goto graph for the grammar S -> S S | a | e Indicate the conflicts (if any) in the various states of the SLR parser. b) Explain the process of handling “Dangling-ELSE” ambiguity. 12. a) Draw a block diagram of phases of a compiler and indicate the main functions of each phase.
b) Define lexeme, token and pattern. Identify the lexemes that make up the tokens in the following program segment. Indicate corresponding token and pattern. Void swap(int I, int j) { int t; t=I; i=j; j=t; } 13. a) What is an LL(1) grammar? When the grammar is said to be LL(1) grammar? b) Design a non-recursive predictive parser for the following grammar. S -> AaAb | BbBb A -> e B -> e c) Discuss how Brute-Force approach operates in top down parsing. 14. a) Draw the structure of LR parser. b) Compute closure(I) and goto(I) for the grammar S -> Aa| bAc| Bc| bBa A -> d B -> d c) Compare bottom up approaches of parsing with all top down approaches. 15. a) Define Language Processor? Differentiate between Compiler and Interpreter. b) Explain, in detail about the Various Phases of Compiler. 16. a) Define Lexical Analyzer. Explain about the Role of Lexical Analyzer. b) Define Regular Expression. List out the Algebraic laws of Regular Expressions. 17. Construct a Predictive Parsing Table for the grammar E->E+T | T T->T*F |F F-> (E) | id 18. a) Differentiate between LR and LL Parsers. b) Explain, in detail about Shift Reduce parser. 19. Construct CLR Parser for the Grammar S->L=R | R L->a|*R R->L 20. a) Differentiate between Pass and Phase of Compiler. b) Define Loader. Explain about different types of Loaders. 21. a) Define the following (i)Token (ii) Pattern (iii) Lexeme
b) Define Regular Expression? Draw the Transition diagram for accepting the identifier. 22. Define LL(1) Grammar? Explain about the Model of a Table driven Parsing. 23. Construct SLR Parser for the following Grammar E -> E+T |T T ->T*F|F F-> (E)|id 24. a) Explain the different types of LR Parsers. b) Explain the error recovery in LR Parsing. 25. a) Define Linker. Explain the different methods of linking. b) Compare compiler and interpreter. 26. Write the regular expression for the following languages 27. a) All Strings of Lower case Letters that contain Five Vowels in order. b) All Strings of Lower case Letters in which the letters are in ascending Lexicographic order. 28. a) What is Parsing? Explain in brief the different types of Parsing Techniques. b) Explain about Error Recovery in Predictive parsing. 29. Construct SLR Parser for the following Grammar S->L=R | R L->*R | id R->L 30. Construct CLR Parser for the following grammar S->CC C->cC|d 31. a) Define Linker. Explain the different methods of Linking. b) Compare Compiler and interpreter. 32. Write the Regular expression for the following Languages a) All Strings of Lower case Letters that contain Five Vowels in order. b) All Strings of Lower case Letters in which the letters are in ascending Lexicographic order. 33. a) What are the Pre-processing steps required for predictive parsing? b) Explain about Error Recovery in Predictive parsing. 34. a) Differentiate between LR and LL Parsers. b) Explain the Shift Reduce parser. 35. Construct LALR Parser for the following Grammar: S->CC C->cC|d. 36. a) What are the functions of pre-processing? b) Explain briefly, the need and functionality of linkers, assemblers and loaders. 37. Explain the role and functions of lexical analyser with the possible error recovery actions.
38.
a) Construct the LL(1) parse table for the fallowing grammaer; Program -> begin d semi X end X -> d semi X | s Y Y -> semi s Y | e b) Distinguish between top-down parsing and bottom-up parsing. 39. Construct the LR Parsing table for the following grammar: E->E + T | T T->T * F | F F -> (E) | id 40. a) Construct the CLR parsing table for the following grammar: S->L=R | R L-> *R | id R->L b) Differentiate between CLR and LALR parsing techniques. 41. a) Describe the Analysis-Synthesis model of compilation. b) What are the different translation rules of a LEX program? Explain. 42. a) Write a LEX program to recognize the decimal numbers. b) What are the three general approaches to the implementation of a Lexical analyzer? Explain. 43. a) Construct LL(1) parse table for the following grammar. S-> Aa|bAc|Bc|bBa A->d B->d b) Explain error-recovery in predictive parsing. 44. a) Explain the procedure for constructing set of LR(0) items. b) Compute LR(0) items for the following grammar: S->L=R | R L-> *R | id R->L 45. a) Explain briefly about LALR parsing technique with an example. b) Explain the various actions performed by shift-reduce parsers with an example. 46. a) Mention the functions of linkers and loaders in pre-processing. b) Describe the functionality of compilers in language processing. 47. a) Construct the transition diagram to recognize the tokens for identifiers and relational numbers. b) What are the reasons for separating lexical analysis from parsing? c) Write a procedure for minimizing number of states of a DFA, and also explain with one example. 48. a) Construct predictive parsing table for the following grammar: S -> (L) | a L -> L,S |S and check whether the following sentences belong to that grammar or not.
(i) (a,a) (ii) (a, (a , a)) (iii) (a, ((a , a), (a , a)) ) b) What are the differences between LL(1) Parsing and LL(k) Parsing? 49. a) Construct the LR(0) items for the “dangling-else” grammar. b) Write an algorithm for constructing LALR Parser table. 50. a) What is a handle? Explain the method of handle pruning with an example. 51. b) Explain the various actions performed by shift-reduce parsers with an example. 52. a) Explain the phases in detail. Write down the output of each phase for the expression a: = b + c *50. b) Give and explain the diagrammatic representation of a language processing system. 53. a) What is meant by input buffering? Explain the use of sentinels in recognizing tokens. 54. b) Explain the functions of lexical analyzer with its implementation. 55. a) Calculate FIRST and FOLLOW sets for the following grammar: E->TE’ E’-> +TE’ | e T->FT’ T’-> *FT’ | e F-> (E) | id b) Explain the model of a non-recursive predictive parser with an example. 56. a) Differentiate between LR parsing and LALR Parsing with an example. b) Compute LR(0) items for the following grammar: S->AB A->a | e B->b | e 57. a) What is a shift reduce parser? Mention the conflicts that occur during shift-reduce parsing. b) Explain the way to implement a shift-reduce parser using a stack by taking an input string for a grammar.
View more...
Comments