[Flex-help] Could someone explain the NFA to DFA transform in ntod ?
flex is a tool for generating scanners
Brought to you by:
wlestes
From: wu y. <yks...@ya...> - 2021-10-18 10:16:39
|
Hi, I'm a newbee to Flex, I wrote a very simple test.l file to trace how the flex run. The test.l is shown as follow:... %% [aeiou]+ {printf("aeiou\n");} ^r {printf("^r\n");} %%... I used flex-2.6.0 to create the lex.yy.c from it. I traced the source code, everything went fine until the ntod function(in dfa.c). It mainly transforms the NFA to DFA state. I know how the epsilon-closure is created. Which confused me is that: 1. what is the sympartition function used for ? (Accord to my understanding, the .l specification created three equivalance class: aeiou、r、and . for any other else. the ccltbl has converted to their equivalance class number. so why does it use the mkeccl function to get the duplist, and what is the duplist used for ? and the cclng ? Could you explain the detail of sympartition ?) 2. why the duplist[sym] == NIL means symbol has unique out-transitions ? how does the symfollowset work ? The NFA state is shown as below: ********** beginning dump of nfa with start state 11 state # 1 257: 0, 0 state # 2 257: 0, 0 state # 3 -1: 4, 0 state # 4 257: 3, 0 [1] state # 5 257: 1, 3 state # 6 114: 7, 0 state # 7 257: 0, 0 [2] state # 8 257: 2, 6 state # 9 -2: 10, 0 state # 10 257: 0, 0 [3] state # 11 257: 5, 9 ********** end of dump |