| CS 454, Section 001 | Sonoma State University | Spring, 2026 |
|
Theory of Computation
|
||
|
Instructor: Henry M. Walker
Lecturer, Sonoma State University | ||
Although much of this course has been well developed in recent semesters, some details may be adjusted from semester to semester. For example, the Signature Project for this course has satisfied SSU's Upper Division GE Area B Requirement for CS Majors for several years, and satisfying that requirement again this semester. However, details of this project likely vary from instructor to instructor and from semester to semester. Also,
C/C++ allows two types of comments:
For the purposes of this problem, suppose all characters within a C/C++ program are from the set Σ = {/, *, a, b, N, E}, where N represents the end-of-line character and E represents the end-of-file character. (In a real C/C++ program, of course, the characters a, b would be extended to all letters, digits, punctuation, etc., but that seems too extensive for this exercise.)
Notes:
| // */; |   // comment, not syntax error |
| f = g/**//h; | // equivalent to f = g / h; |
| /*//*/ l(); | // equivalent to l(); |
| m = n//**/o + p; | // equivalent to m = n + p; |
Exercise: Draw an NFA state diagram with no more than 12 states that accepts exactly "programs" in which all comments are correctly specified in C/C++ and rejects any "program" that does not have the proper comment structure.
Recognizing Numbers Although C/C++ allow several different formats for numbers, this problem considers only two main forms.
Notes: For this problem:
As with all programs for this course,
|
created Fall, 2023 revised Fall, 2023 revised October, 2025 |
|
| For more information, please contact Henry M. Walker at walker@cs.grinnell.edu. |
|
Copyright © 2011-2026
by Henry M. Walker.
|