CS 3304 Homework #1

Date Assigned: September 3, 2003
Date Due: September 10, 2003, in class, before class starts
  1. (5+5=10 points) Write a regular expression to denote the set of all strings of letters that contain the five vowels in order. Assume that letters can only be lower case. Then, re-state the regular expression in terms of a context free grammar.

  2. (5 points) What language does this grammar generate?
    
    <text> -> a <text> b <text>
    <text> -> b <text> a <text>
    <text> -> epsilon
    
    where "epsilon" is the empty symbol, a terminal.

  3. (10 points) The following grammar for if-then-else is proposed to remedy the dangling else ambiguity:
    
    <stmt> 		-> if <expr> then <stmt> | <matched_stmt>
    <matched_stmt> 	-> if <expr> then <matched_stmt> else <stmt> | <other>
    
    Show that this grammar is still ambiguous.

  4. (10 points) Consider the language given by "Strings of 0s and 1s of the form xx", i.e., consisting of sentences such as "0000", "0101", "11", "010010", and so on. Is this language regular? (i.e., can it be defined by a regular expression?) If yes, give a regular expression. If no, state why not.

  5. (5 points) Problem 8 of Chapter 3 in your textbook.

  6. (10 points) Problem 20 of Chapter 3 in your textbook.

Return Home