If we refer to these lines by number (1 through 6), then which line(s), if any, match each of the following (grep) REs?We shall now begin the discussion of the design of program for generating lexical analyzers automatically. We first introduce a very useful notation, called regular expressions, suitable for describing tokens. We later show how regular expressions can be converted automatically into finite automata, which are just formal specifications for transition diagrams. Still later, we shall discuss the implementation of finite automata by programs.
If you are unsure about a question, feel free to try out a few experiments with grep or with the "search" command / in vi. Remember that neither of these programs expect you to enter the "/" delimiters when you type the RE for which to search, and that both use case sensitive searches by default.
Find all possible matches for each of the following (egrep) REs:are just formal specifications for
hello, there. or is "hi" or "howdy" more to your liking? ----- -- -----
The quick brown fox jumps over the lazy dog. --- ---
How many sentences are here? There are two. No, three! ----- ---- ------
The number 045-35-2344 is a random SSN. -----------
This sentence does not have many long words. -------- -----
reusable software is software that was designed to be reused. -------- ------
Does this sentence end in a period? This one does. --------------
Politicians can act artificial, but do they have intelligence? -----------------------------------------
computer science is the study of computing, and how computers work. -------- --------- ---------
This is a short sentence. --------- ---------- ----------------
1. 1,3,4,5,6 2. 2,3 3. 4. 1,6 etc.Give one problem per line, with no intervening extraneous lines. If there are no matches, terminate the line after the space following the period.
For questions 11 through 15, enter the problem number followed by a period on a line with nothing else. Then list the matched strings one per line, with no leading or trailing blanks, in the order they occur, left to right, top line to bottom line. Follow all the lines containing matched strings with exactly one blank line. For instance, the RE /transition/ would be answered with
11. transition 12. etc.For questions 16 through 25, enter the problem number followed by a period, a space, a slash, the grep RE, and a slash terminating the line. For instance,
16. /h[eio][a-z]*/ 17. /t[a-z]*/ etc.You are to submit your assignment via email to the class account at cs1206@ei.cs.vt.edu. Your subject line should read "HW 3". You should immediately get an acknowledgement back.
Also, remember that no late assignments are accepted.