Commit e5ca180
committed
Change incomplete DFA to a complete one
Previously, a hash map was used for the DFA state transitions (key was
the symbol; value was the next state) because each DFA state had only
the transitions that were really necessary and did not have transitions
for every symbol of the alphabet.
Now a complete DFA is created, meaning each state has transitions for
each symbol of the alphabet. In addition, the DFA now has a real dead
state. So, the DFA now meets the strict definition of a complete DFA.
This change allowed the hash map that stored the DFA state transitions
to be replaced with an array, which greatly increases the speed of the
DFA since there is now no need to compute hashes.1 parent 5ed82cf commit e5ca180
3 files changed
+37
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| |||
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
66 | | - | |
67 | | - | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | | - | |
20 | | - | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
440 | 442 | | |
441 | 443 | | |
442 | 444 | | |
443 | | - | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
444 | 448 | | |
445 | 449 | | |
446 | 450 | | |
| |||
468 | 472 | | |
469 | 473 | | |
470 | 474 | | |
471 | | - | |
| 475 | + | |
472 | 476 | | |
473 | 477 | | |
474 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
475 | 484 | | |
476 | 485 | | |
477 | | - | |
| 486 | + | |
478 | 487 | | |
479 | 488 | | |
480 | 489 | | |
| |||
491 | 500 | | |
492 | 501 | | |
493 | 502 | | |
494 | | - | |
| 503 | + | |
495 | 504 | | |
496 | 505 | | |
497 | 506 | | |
498 | 507 | | |
499 | 508 | | |
500 | | - | |
| 509 | + | |
501 | 510 | | |
502 | 511 | | |
503 | 512 | | |
| |||
547 | 556 | | |
548 | 557 | | |
549 | 558 | | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
550 | 563 | | |
551 | | - | |
552 | | - | |
| 564 | + | |
| 565 | + | |
553 | 566 | | |
554 | 567 | | |
555 | | - | |
556 | 568 | | |
557 | 569 | | |
558 | 570 | | |
| |||
566 | 578 | | |
567 | 579 | | |
568 | 580 | | |
569 | | - | |
| 581 | + | |
570 | 582 | | |
571 | 583 | | |
572 | 584 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
0 commit comments