Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers > question on NFA...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 2356 of 2421
Post > Topic >>

question on NFA and DFA generated by flex

by Uwe Naumann <naumann@[EMAIL PROTECTED] > Mar 7, 2008 at 07:10 AM

Consider the following simple flex input:

++++++++++++++++

var v

%%

{var} {}
.. {}

%%

int main()
{
  yylex();
  return 0;
}

++++++++++++++++

Running flex in trace mode (flex -T scanner.l) it tells me
about the generated NFA and DFA:

++++++++++++++++

%%
1       (v)
2       .
3       End Marker


********** beginning dump of nfa with start state 11
state #    1    257:     0,    0
state #    2    257:     0,    0
state #    3    118:     4,    0
state #    4    257:     0,    0  [1]
state #    5    257:     1,    3
state #    6     -1:     7,    0
state #    7    257:     0,    0  [2]
state #    8    257:     5,    6
state #    9     -2:    10,    0
state #   10    257:     0,    0  [3]
state #   11    257:     8,    9
********** end of dump


DFA Dump:

state # 1:
        1       4
        2       5
        3       6
state # 2:
        1       4
        2       5
        3       6
state # 3:
state # 4:
state # 5:
state # 6:
state # 3 accepts: [4]
state # 4 accepts: [2]
state # 5 accepts: [3]
state # 6 accepts: [1]

....

++++++++++++++++

Can anybody tell me what states

2 in NFA (dead state?)
3 in DFA (corresponding dead state resulting from subset construction?)
2 in DFA (alternative start state but still dead?)

are good for?

I understand that "accepts: [1]" indicates a final state accepting "v".
What is "accepts: [4]" trying to tell me? I can only see three rules...

Thanks for your help.

Uwe.




 1 Posts in Topic:
question on NFA and DFA generated by flex
Uwe Naumann <naumann@[  2008-03-07 07:10:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 10:58:00 CDT 2008.