{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# hw2(1) - University of Central Florida School of Computer...

This preview shows pages 1–4. Sign up to view the full content.

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

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2. Construct a left-linear 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 Adler’s 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 for L r . Above is the “reverse” of the automata for L . Just for fun, we can

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}