Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

some questions about regular expressions The first one in q1 is wrong because () also counts the question itself is specified in the photo as

some questions about regular expressions

image text in transcribed

The first one in q1 is wrong because () also counts

the question itself is specified in the photo as shown

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: 1. a slash followed by a star, followed by 2. the body of the comment, followed by 3. a star followed by a slash. The body of the comment can be empty, or can contain any characters except the two character sequence "+/". 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 = [/] Question 1: Below are 5 incorrect JLex patterns for the kind of comment defined above. For each pattern, explain what is wrong. For example, you might say The pattern does not allow the comment body to include stars, or The pattern does allow the comment body to include */. If the pattern both disallows some "good" comments and allows some "bad" comments, you need to give two explanations, one for each issue. In addition to the explanations, you need to provide example strings that illustrate each issue; 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. {SLASH} {STAR} [*(*/)]*{STAR} {SLASH) {SLASH} {STAR} ( )*{STAR} {SLASH} {SLASH} {STAR}([**]*(STAR} +[**/]) * {STAR} + {SLASH} {SLASH}{STAR}([**][*/])+{STAR} {SLASH} {SLASH}{STAR} [**]*{STAR}+{SLASH}+ Question 2: Give a correct JLex pattern for comments as defined above. You may define and use additional macros. Make your pattern as readable as possible

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 9 For Linux UNIX And Windows Advanced Database Administration Certification Certification Study Guide

Authors: Roger E. Sanders, Dwaine R Snow

1st Edition

1583470808, 978-1583470800

More Books

Students also viewed these Databases questions

Question

12-40. What decision(s) do you recommend?

Answered: 1 week ago