100% found this document useful (1 vote)
154 views2 pages

Compiler Construction Final Paper Questions

This document contains 10 questions for a compiler construction assignment. The questions cover a range of topics in compiler design including: - Panic mode and phrase level recovery with examples - Constructing parse trees from context-free grammars - Developing unambiguous context-free grammars - Lexical analysis including identifying lexemes and lexical values - Computing the number of prefixes and suffixes in a string - Developing regular expressions and DFAs for language recognition - Creating predictive parsing tables from grammars - Calculating first and follow sets for grammars - Building LL(1) parsing tables

Uploaded by

Faisal Shehzad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
154 views2 pages

Compiler Construction Final Paper Questions

This document contains 10 questions for a compiler construction assignment. The questions cover a range of topics in compiler design including: - Panic mode and phrase level recovery with examples - Constructing parse trees from context-free grammars - Developing unambiguous context-free grammars - Lexical analysis including identifying lexemes and lexical values - Computing the number of prefixes and suffixes in a string - Developing regular expressions and DFAs for language recognition - Creating predictive parsing tables from grammars - Calculating first and follow sets for grammars - Building LL(1) parsing tables

Uploaded by

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

Compiler Construction

Assignment No. 01
Due Date 18-03-2020 (Before Examination)

Note : Write handwritten solution on A4 size paper. Do not use any file cover for assignment
submission. Just write question No. and write your answer.
Question No. 01
Differentiate Panic Mode and Phrase Level Recovery with example.
Select a suitable example (other than the examples discussed in lectures) and show all the phases
of compiler construction.
Question No. 02
Consider the Following Grammar
S  SS+ | SS* | a
i. Show how the string aa+a* can be generated by this grammar
ii. Construct a parse tree for this string
iii. What language does this grammar generates
Question No. 03
Construct unambiguous Context Free Grammar for each of the following language
i. Left associative lists of identifiers separated by commas
ii. Right associative lists of identifiers separated by commas
Question No. 04
Consider the following code
float getval(int x){
return (x>10.0? 10.0 : x/2);
}
Divide the above program code into appropriate lexemes, using discussion of lexeme and tokens
in the lecture as hint. Which lexeme should get associated lexical value? What should those values
be?
Question No. 05
In a string of length N, how many of the following are there?
Prefixes
Suffixes
Question No. 06
Write regular definition for the following language
All strings of lowercase letters that contains five vowels in order
Question No 07
Suppose we have two tokens (1) the keyword while and (2) identifier, which are strings of letters
and digits beginning with a letter other than while. Show DFA for these tokens
Question No. 08
Consider the following grammar
S  0S1 | 01
Devise predictive parser and show the parsing table. You may left factor and of eliminate left
recursion from your grammar first
Question No. 09
Compute the First and Follow of the following grammar
S  0S1 | 01
S  S+S | SS | (S) | S* | a
Question N0. 10
Consider the following grammar
E  TX
T  ( E ) | int Y
X  +E | 
Y  *T | 
Construct LL(1) Parse table and verify the following string
int * int$

You might also like