2 Practice Problems on Compiler Construction - Homework 1 | COMP 412, Assignments of Computer Science

Material Type: Assignment; Professor: Cooper; Class: COMPILER CONSTRUCTION; Subject: Computer Science; University: Rice University; Term: Fall 2008;

Typology: Assignments

Pre 2010

Uploaded on 08/19/2009

koofers-user-iw6-1
koofers-user-iw6-1 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COMP 412
Fall 2008
Homework 1 Due Monday, September 22, 2008
This homework exercise is intended to give you practice in creating and manipulating
both regular expressions and finite automata.
As an optional warmup exercise, you should do Exercise 2.3.1 in the textbook (page
727). Do not include it on the paper you submit for your homework. It is practice to
make you more comfortable writing regular expressions.
To submit as homework, do the following problems:
1. Derive a regular expression for the set of strings that consist of lower-case alphabetic
characters, with the constraint that each string has exactly two vowels. (For this
problem, the letter y is a consonant.)
You can use the abbreviation CONS for the regular expression
[ b | c | d | f | g | h | j | k | l | m | n | p | q | r | s | t | v | w | x | y | z ]
Now, derive a second regular expression for the set of strings that consist of lower-
case alphabetic characters, with the constraint that each string has exactly two distinct
vowels.
2. Consider the following regular expression
ae | ai | ao | au | ea | ei | eo | eu
a. Derive an NFA from this regular expression using Thompson’s construction
b. Convert the NFA to a DFA using the subset construction
c. Minimize the number of states in the DFA using Hopcroft’s algorithm

Partial preview of the text

Download 2 Practice Problems on Compiler Construction - Homework 1 | COMP 412 and more Assignments Computer Science in PDF only on Docsity!

COMP 412

Fall 2008 Homework 1 Due Monday, September 22, 200 8 This homework exercise is intended to give you practice in creating and manipulating both regular expressions and finite automata. As an optional warmup exercise, you should do Exercise 2.3.1 in the textbook (page 727). Do not include it on the paper you submit for your homework. It is practice to make you more comfortable writing regular expressions. To submit as homework, do the following problems:

  1. Derive a regular expression for the set of strings that consist of lower-case alphabetic characters, with the constraint that each string has exactly two vowels. (For this problem, the letter y is a consonant.) You can use the abbreviation CONS for the regular expression [ b | c | d | f | g | h | j | k | l | m | n | p | q | r | s | t | v | w | x | y | z ] Now, derive a second regular expression for the set of strings that consist of lower- case alphabetic characters, with the constraint that each string has exactly two distinct vowels.
  2. Consider the following regular expression ae | ai | ao | au | ea | ei | eo | eu a. Derive an NFA from this regular expression using Thompson’s construction b. Convert the NFA to a DFA using the subset construction c. Minimize the number of states in the DFA using Hopcroft’s algorithm