



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Main points of this exam paper Compiler Construction and Languages are: Grammar, Language, Illustrates, Non-Deterministic, Finite State, State Automaton, Tabular Form, Deterministic Finite, Productions, Immediate Left Recursion
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!




(NFQ – Level 8)
Instructions Answer FOUR questions All questions carry equal marks.
Examiners: Mr. E. A. Parslow Mr. P. O Connor Dr. D. Chambers Mr. C.E. Manning
Part A. (5 marks) L is a language where all the words have exactly the same number of as, bs, and cs. E.g. aabccb, cbbbaacac. Write a grammar for language L
Part B. (6 marks) Write a Type 3 Grammar for the language described by ad^ d+^ (ddcd)fg [No marks available for a Type 2]
Part C. (7 marks) Construct a deterministic finite state automaton (DFA) that is equivalent to ad^ d+^ (ddcd)fg [No marks available for a non deterministic machine]
Part D. (7 marks) Table 1
State ε a b c 0 - Start 3 1 2 1 3 2 3 2 - Accept 3 2 3 1
Table 1 illustrates a non-deterministic finite state automaton in tabular form. Construct an equivalent deterministic finite state automaton.
Part A (10 marks) Construct an LR parser for the language described by grammar G 4
G 4 :
Part B (15 marks) Construct a top down parser for the language described by G 5
G 5 : E -> E + T E -> E – T E -> T T -> T * F T -> T / F T -> F F -> ( E ) F -> I
Part A (10 marks) State the pumping lemma for regular languages.
Part B (15 marks) Use the pumping lemma to prove that the language
is not regular
Part A (7 marks) Use Dijkstra’s shunting algorithm to rewrite a$bc$d@e@f@g#h@j in postfix form. The order of precedence for operators is @$# with # having the highest prececence.
Part B (6 marks) How might a shift register be used for a reduction in strength? Illustrate your answer with code.
Part C (6 marks) What is common sub-expression elimination? Illustrate your answer with code.
Part D (6 marks) What is code hoisting? Illustrate your answer with code
Part A (5 marks) What is register slaving?
Part B (5 marks) What is a register descriptor table?
Part C (7 marks) In what circumstances is spilling advisable?