Homework 1: Lexical Analysis
due: Monday, January 31, in class
- A comment in the C language begins with the two-character sequence
"/*", followed by the body of the comment, and then the sequence
"*/". The body of the comment may not contain the sequence
"*/", although it may contain the "*" and "/"
characters.
- Write a regular expression that recognizes exactly C comments. Use the
syntax [^chars] to indicate the possibility of any character except
the characters listed in chars.
- Some implementations of C permit nested comments. Why can't you
write a regular expression to recognize this extended syntax for
comments?
- Appel, problem 2.1 (a, f)
- Appel, problem 2.3
- Appel, problem 2.6
- Appel, problem 2.9