You are on page 1of 2

Computer Engineering Department System Programming Question Bank

*Solve this questions for Mid sem examination

1. List various phases of a language processor. Explain roles of first two phases of it. Also explain symbol table. 2. Explain various phases of Compiler. Explain in detail 3. What language is generated by the following grammars. a. S->SS+ | SS* | a b. S->0S1 | 01 c. S->S(S)S | d. S->aSbS | bSaS | 4. What is the difference between abstract syntax tree and parse tree? 5. Differentiate token, pattern and lexeme. 6. Explain buffer pair scheme. 7. What is a sentinel? 8. Define prefix, suffix, substring, proper prefix/suffix,subsequence 9. Convert the RE to DFA a. ( ( | a ) b * ) * b. ( a * | b * ) * 10. Write unambiguous production rules (grammar) for arithmetic expression containing +, - , *, / and ^ (exponentiation). Construct parse tree and abstract syntax tree for: <id> <id> * <id> ^ <id> + <id> 11. Construct DFA for following regular expression: a* ( b* | c*) (a | c ) * # 12. Minimize the FA

a C b A a
a

b a B b a D b a E

13. Construct NFA from RE ( a | b ) * abb ( a | b ) * 14. Describe working of LL(1) parser and parse following string : <id> * <id> * <id> + <id> Here the meaning is same as id*id*id+id

15. What is operator precedence parsing? Show operator precedence matrix for following operators: +, - , *, (,). Parse following string: <id> + <id> * <id> 16. Define ambiguous grammar. Give an example 17. Left factor the given grammar S-> iEtS | iEtSeS |a E->b 18. Left factor the given grammar. If there is left recursion, eliminate it. E ->E + T | T T -> T F | F F -> F* | P P-> a | b 19. Rewrite grammar by eliminating left recursion. S->Aa | b A->Ac | Sd| 20. Define FIRST and FOLLOW 21. Explain following. (i) Execution Gap (iii) Phases of Compiler (ii) Interpreter (iv) Language Migrator 22. Given following expression, x = - a * b + - a * b (i) Write three address code for the expression. (ii) Optimize the three address code if it is possible to do so. (iii) Give triple implementation for the three address code of the expression. 23. Given a grammar, E -> TA, A -> +TA | T -> VB B -> *VB | V -> id | (E) Develop an LL(1) parser table and parse following string using the parsing table. id * ( id + id) 24. Convert given regular expression to DFA. The expression is (a | b)*abb# 25. Write regular expressions of a given language. The language consists of all strings of as and bs which ends with a and does not contain bb. 26. Differentiate between top down and bottom up parsing 27. Define handle, and 4 actions of shift reduce parsing 28. What are the conflicts of shift reduce parsing 29. Find a Stack Implementation of A Shift-Reduce Parser for the string id+id*id 30. What is bottom up parser? Explain operator precedence parser. Let a grammar for a language is E-> E+E | E*E | id. Check validity of following string using stack based operator precedence parser. id * id + id * id

You might also like