


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
Material Type: Exam; Class: PROGRAMMING LANGUAGES; Subject: Computer Science; University: Rensselaer Polytechnic Institute; Term: Fall 2008;
Typology: Exams
1 / 4
This page cannot be seen from the preview
Don't miss anything!



I Regular Expressions.
P1. Consider the following regular expression which has been divided into three parts:
โ โ 1 โ โ โ โ 2 โ โ โ โ 3 โ โ (a|b)โ^ (a|c) (dโ|cโ)+ For each string below either write that it is not generated by this regular expression, or circle and label the sections of each string generated by regular expression parts 1, 2, 3. For example:
a a a c d โ โ 1 โ โ โ โ 2 โ โ โ โ 3 โ โ
P2. Consider the following regular expression divided into parts:
โ โ 1 โ โ โ โ 2. 1 โ โ โ โ 2. 2 โ โ โ โ 2. 3 โ โ โ โ 2. 4 โ โ (aa|bb)โ^ ((ab|ba) (aa|bb)โ^ (ab|ba) (aa|bb)โ)โ For each string below either write that it is generated by the regular expression or that it is not generated by it:
1
II Context-free grammars, ambiguity and precedence.
P1. Consider the following grammar with two operators, # and $. Capital letters denote nonterminals, and small letters denote terminals.
S ::= B B ::= B#E | B$E | E E ::= B | a | b
III LL and LR Grammars.
P1. Consider the if-then-else grammar below. S and E denote nonterminals and i, t, e, b and a denote terminals:
S ::= iEtSeS | iEtS | a E ::= b
VI Prolog.