Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a regular expression for comments of the form /* .... */. Haskell -The comment begins with /* and end with the first */ encountered.

Write a regular expression for comments of the form /* .... */.

Haskell

-The comment begins with /* and end with the first */ encountered. -Optional whitespace can precede the comment or follow the comment, but nothing else. Whitespace -consists of spaces and or tabs (\t). Don't include newline ( ). -The text of the comments can include letters or digits, space, tab, underscore, *, and /. - The comment can include /*, but we don't nest comments. -The star of the beginning /* cannot be the star of the ending */. -The symbol before the ending */ doesn't have to be whitespace. -Inside a regular expression, if you want a star symbol, escape it as \*, since just * means Kleene star. (So within the expression, write /\* to mean a slash followed by a star. As an expression, just /* means zero or more slashes)

Some strings that should fail to match: /* xyz */ */ By rules 1 and 2 /* /* xyz */ */ By rules 1, 2, and 4 /*/ By rule 5

Some strings that should match: /**/ By rules 3, 5, and 6 /*///***/ By rules 3, 5, and 6 /* * * Typical * * */ By rules 2 and 3

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions

Question

Solve for x: 2(3x 1)2(x + 5) = 12

Answered: 1 week ago

Question

2. What is the impact of information systems on organizations?

Answered: 1 week ago

Question

Evaluate the impact of technology on HR employee services.

Answered: 1 week ago