CSE 40243 Fall 2025

Compilers and Language Design Course at the University of Notre Dame

Homework 2

Problem 1: Convert these REs into NFA’s using Thompson’s construction. Avoid taking “shortcuts”.

Problem 2: Convert the NFAs in the previous problem into DFAs using the subset construction method.

Problem 3: Consider how Thompson’s construction would be implemented in code instead of a sketch.

Suppose that each NFA is represented by an object A with the following properties: A[s,i] is the transition matrix yielding the next integer state(s) given current state s and input i; A.start is the integer start state of the NFA; A.accept is the integer accepting state of the NFA; A.states is the number of states in the NFA.