Nfadef

Nfadef - ( ) is a partial relation on its domain and has...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
NFAs and DFAs COT 4210 Fall 2001 © Dr. David A. Workman School of EE and CS University of Central Florida
Background image of page 1

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

View Full DocumentRight Arrow Icon
05/01/09 2 DFA to C code q 0 p1 p2 pn a n a 2 a 1 Σ = {a 1 , a 2 , …, a n } Boolean File.EOF(){. .} //This is a boolean function //returning true if an end-of-file //has been found, false if not all // input has been read. Char File.getChar(){. .} //This function returns the next //character in the input stream //if input remains to be read. Char a; //next input character q0: if( file.EOF() ) { output(" accept !"); exit(0);} a = file.getChar(); switch( a ){ case a 1 : goto p1; case a 2 : goto p2; case a n : goto pn; } p1:if( file.EOF() ) { output(" reject !"); exit(0);} a = file.getChar(); switch( a ){ case a 1 : goto …; case a 2 : goto …; case a n : goto …; } p2:p1:if( file.EOF() ) { output(" accept !"); exit(0);} a = file.getChar(); switch( a ){ case a 1 : goto …; case a 2 : goto …; case a n : goto …; }
Background image of page 2
05/01/09 3 NFA Definition: An NFA is a 5-tuple, M = (Q, Σ , δ , Q 0 , A) where Q fn rel Q Q Q 2 }) { ( : }) { ( : Λ Σ × Λ Σ × δ The relation
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ( ) is a partial relation on its domain and has range set, Q. The function ( ) is a total function on its domain and has range set, 2 Q . To understand the difference in these two definitions, recall from Discrete I the definition of a relation R from A to B . This is depicted in the figure below. A (domain set) B (range set) A relation R is an arbitrary subset of A B . 05/01/09 4 NFA EXAMPLE: To illustrate the definition of the transition relation ( ), let Q = {1,2,3} and let = { a, b} rel Q 3 2 1 (1,a) (2,a) (3,a) (1,b) (2,b) (3,b) (1, )(2, )(3, ) 05/01/09 5 NFA 2 Q {1,2,3} {2,3} {1,3} {1,2} {3} {2} {1} (1,a) (2,a) (3,a) (1,b) (2,b) (3,b) (1, )(2, )(3, ) fn 05/01/09 6 Example 1: a b * *1 {1,4} {1} 2 {4,5} {2} 3 {2} {3} *4 {5} {5} {4} 5 {1,3} {1,3,5 }...
View Full Document

Page1 / 6

Nfadef - ( ) is a partial relation on its domain and has...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online