Efficient algorithm for converting a character set into a nfa/dfa

前端 未结 5 764
慢半拍i
慢半拍i 2021-02-14 06:29

I\'m currently working on a scanner generator. The generator already works fine. But when using character classes the algorithm gets very slow.

The scanner generator pr

5条回答
  •  野的像风
    2021-02-14 06:50

    In this library (http://mtimmerm.github.io/dfalex/) I do it by putting a range of consecutive characters on each transition, instead of single characters. This is carried through all the steps of NFA constuction, NFA->DFA conversion, DFA minimization, and optimization.

    It's quite compact, but it adds code complexity to every step.

提交回复
热议问题