Draw a deterministic finite-state machine (FSM) for the language of Java comments delimited by "/*" and "*/". Here are some examples:
+---+ +---+ +---+ | S | -----> | | -----> | F | +---+ x +---+ y +---+You may label the edges of your FSM with single characters, or with "any" (to mean any single character) or with "any except x, y, z" (to mean any single character except the ones in the list -- x, y, z in this example).
Hint: For each state in your FSM, think carefully about what should happen if a star is seen, if a slash is seen, or if some other character is seen.
Write a regular expression for the language of Java comments delimited by "/*" and "*/". Use "star" and "slash" instead of the actual characters (to avoid getting confused between the star characters and the star operator that means "zero or more"). You may also use "not-star" to mean any character except a star, "not-slash" to mean any character except a slash, and "not-star-or-slash" to mean any character except a star or a slash.
In the C-- language (the language whose compiler you are writing) text starting with a sharp sign (#) up to the end of the line is considered to be a comment. This is so that you can write C-- programs that do I/O and can be compiled using a C++ compiler (because to do I/O you need to have "#include <iostream.h>" in your program). However, this also allows many C-- programs that cannot be compiled using a C++ compiler.
Another possibility is allow more limited use of sharp signs in a C-- program. For this assignment, you are to write a JLex pattern for INCLUDE tokens, defined below. You may also define JLex macros (e.g., for WHITESPACE) and use them in the pattern that you write.
An INCLUDE token:
Test your pattern using the following files (only include.jlex needs to be modified):
You can also find these files in (and copy them from) ~cs536-1/public/hw1/
Hand in a print-out of your modified version of include.jlex.