Chapter 3: Lexical Analysis

Example

. Let L = {a, b, .., z} and D = {0, 1, 2, . 9} then

. LUD is a set of letters and digits

. LD is a set of strings consisting of a letter followed by a digit

. L* is a set of all strings of letters including ?

. L(LUD)* is a set of all strings of letters and digits beginning with a letter

. D + is a set of strings of one or more digits

Example:

Let L be a the set of alphabets defined as L = {a, b, .., z} and D be a set of all digits defined as D = {0, 1, 2, .., 9}. We can think of L and D in two ways. We can think of L as an alphabet consisting of the set of lower case letters, and D as the alphabet consisting of the set the ten decimal digits. Alternatively, since a symbol can be regarded as a string of length one, the sets L and D are each finite languages. Here are some examples of new languages created from L and D by applying the operators defined in the previous slide.

. Union of L and D, L U D is the set of letters and digits.

. Concatenation of L and D, LD is the set of strings consisting of a letter followed by a digit.

. The Kleene closure of L, L* is a set of all strings of letters including ? .

. L(LUD)* is the set of all strings of letters and digits beginning with a letter.

. D+ is the set of strings one or more digits.