This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: University of Central Florida School of Computer Science COT 4210 Spring 2004 Prof. Rene Peralta Solutions to Homework 2 Consider integers written in base 3 with no leading 0s. Let L be the set of such strings which represent even numbers. 1. Construct a DFA that accepts L . The red state means I am odd. The yellow state means I am even. 1 2. Construct a leftlinear grammar for L . Associate with each state U the set of strings whose computation can end in U. Then we have (let B,R,Y denote be blue,red,yellow states, resp.) B R ( Y + B )1 + R (2 + 0) Y B 2 + R 1 + Y (2 + 0) which simplifies to R ( Y + )1 + R (2 + 0) Y 2 + R 1 + Y (2 + 0) The starting symbol of the grammar is Y . 3. Write a regular expression for L . Using Adlers rule we have R = ( Y + )1(2 + 0) * then Y = 2 + ( Y + )1(2 + 0) * 1 + Y (2 + 0) factoring Y Y = 2 + 1(2 + 0) * 1 + Y (1(2 + 0) * 1 + 2 + 0) and finally Y = (2 + 1(2 + 0) * 1)(1(2 + 0) * 1 + 2 + 0) * 2 4. Write a regular expression for4....
View
Full
Document
This note was uploaded on 06/09/2011 for the course COT 4210 taught by Professor Staff during the Spring '08 term at University of Central Florida.
 Spring '08
 Staff
 Computer Science

Click to edit the document details