Answers of Questions in Assignment 1

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 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)*

You might also like