CS 454, Section 001 Sonoma State University Spring, 2026
 
Theory of Computation
Instructor: Henry M. Walker

Lecturer, Sonoma State University
Professor Emeritus of Computer Science and Mathematics, Grinnell College

Although much of this course has been well developed in recent semesters, some details may be adjusted from semester to semester.
In particular, the Signature Project for this course satisfies SSU's Upper Division GE Area B Requirement for CS Majors, but details of this project likely vary from instructor to instructor and from semester to semester.
In particular,

Assignment on DFAs/NFAs and Regular/Non-regular Expressions

A Regular Expression and Its Corresponding NFA

  1. Consider the regular expression ( (1 1* 00 )* ) ∪ 01*.
    1. Identify two strings that are members of the language described by this regular expression.
    2. Identify two strings that are NOT members of the language described by this regular expression.
    3. Use the procedure described in Lemma 1.55 to covert the above regular expression to an NFA.

Regular and Non-regular Languages

  1. For each of the following, determine if the language is regular or not, and justify your answer in each case.
    1. Let the alphabet Σ = {0, 1, +, =} and let A be the language:
      A = {x=y+z | x, y, and z are binary unsigned integers and x is the sum of y and z}
      Is A an regular language? Justify your answer.
    2. Let the alphabet Σ = {a, b}, and let B be the strings over this alphabet with either an even number of a's or an odd number of b's, but not both an even number of a's and an odd number of b's. Is B a regular language? Justify your answer.
    3. Consider the alphabet Σ = {a, b}. For a string s ∈ Σ*, define sR as the reverse of s. That is, the characters in sR are the same as the characters in s, but the characters appear in the reverse order. Is {s sR | s ∈ Σ*} a regular language? Be sure to justify your answer.

DFA-based/Table-driven Program

  1. Recognizing Numbers Although C/C++ allow several different formats for numbers, this problem considers only two main forms.

    Notes: For this problem:

    1. Write a DFA to recognize both integers and floating-point numbers, as defined above.
      When scanning characters to identify a number, find the longest sequence of characters that can be a number.
      Thus, 123.456 should be identified as a floating-point number, not the integer 123 , following by the floating-point number .456 .
      Similarly, 123.45.6789 should be identified as the floating-point number 123.45 , followed by the floating point number .6789 .
    2. Write a regular expression to accept all strings that are either integers or floating-point numbers, as defined above.
    3. Using either the program dfa-comments.c or or the template dfa-comments-2.c as an example, write a DFA-based/table-driven program that uses your DFA of part a to identify and print all numbers read (until an end-of-file character is encountered). For each number identified, the program should label it appropriately as an integer or floating point type.

      As with all programs for this course,

      • The program must conform to the SSU CS C/C++ Style Guide.
      • For this problem, submit both a listing of the C/C++ program, and a description of test runs, and the corresponding results.
      • If you use a file in testing, print and submit the contents of the file.
created Fall, 2023
revised Fall, 2023
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.