CS536 Homework 1
|
QuestionsHomework assignments must be done individually. Collaboration on homework assignments is not allowed. Question 1:Java (as well as C and C++) allows comments delimited by "/*" and "*/". This kind of comment can be defined in English as follows: A comment consists of three parts:
Note that the body of a comment can include stars and slashes, just not "*/". Assume that the following JLex macros have been defined: SLASH = [/] STAR = [*] Label each of the following JLex patterns as being correct/incorrect for the type of the comment described above.
If the pattern both disallows some "good" comments and allows some "bad" comments, give two explanations, one for each problem with the pattern. Then, for each problem with the pattern, give a string that illustrates the problem; i.e., give a string that is not matched by the pattern but is a "good" comment and/or give a string that is matched by the pattern but is a "bad" comment. Be sure that it is clear whether your example strings are intended to be "good" or "bad" comments. |