Answers of Questions in Assignment 1



Answers of Questions in Assignment 1

1.1

Describe the languages denoted by the following regular expressions:

1. 0(0|1)*0

Strings of 0s and 1s that begin and end with 0.

2. (0|1)*0(0|1)(0|1)

Strings of 0s and 1s where the third bit from the end is 0.

3. 0*10*10*10*

Strings of 0s and 1s that have three 1s.

1.2

Write the regular definitions for the following languages.

1. Floating-point numbers. A floating-point number has the following parts: an integer, a decimal point (.), a fractional part, and an exponent. The exponent, if present, is indicated by the ASCII letter e or E followed by an optionally signed integer.

Integer -> [+|-] Digits

Fraction -> Digits

Exponent -> (e|E)Integer

FloatingPointNumber -> Integer '.' Fraction [Exponent]

2. All strings of letters in which the letters are in ascending lexicographic order.

A*B*...Z*

3. Comments consisting of a string surrounded by /* and */ without an intervening */ unless it appears in side the quotes " and ".

Σ1 : the set of all characters and "*/"

Σ2 : Σ1−{/,*}

Comment -> /* (/* ** (Σ2 Σ1*)*)* */

1.3

Implement a program in C for recognizing the language as specified by the following regular expression:

letter (letter | digit)*

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download

To fulfill the demand for quickly locating and searching documents.

It is intelligent file search solution for home and business.

Literature Lottery

Related searches