SYNTAX ANALYSIS
ROLE OF THE PARSER
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Odd nonempty strings
|
|
Even nonempty strings
|
|
Empty and nonempty binary strings
|
|
Nonempty binary strings
|
Detailed explanation-1: -Consider the regular expression (0|1)*. This stands for the set of all strings of binary digits. If we match this pattern against 0101B, there are 4 possible substrings it can match, namely 0, 01, 010, and 0101. Often we try to match the longest possible substring, in this case 0101.
Detailed explanation-2: -Since they mean “(0 or 1) repeated 0 or more times", both of them can generate the language 101 .
Detailed explanation-3: -Every regular expression over 0, 1 is itself a string over the 8-symbol alphabet 0, 1, +, *, (, ), , Ø. regular expression is a base-9 representation of a unique integer. Countably infinite!
Detailed explanation-4: -It matches “", “01", “0101", “01010101", etc. (01)* is nothing like (0*1*). The latter is just zero or more 0s followed by zero or more 1s, and never a 0 after a 1.