4 ms·
Thompson introduced the multiple-state simulation approach in his 1968 paper. In his formulation, the states of the NFA were represented by small machine-code s
by tc 17y ago
Thompson introduced the multiple-state simulation approach in his 1968 paper. In his formulation, the states of the NFA were represented by small machine-code sequences, and the list of possible states was just a sequence of function call instructions. In essence, Thompson compiled the regular expression into clever machine code. Forty years later, computers are much faster and the machine code approach is not as necessary.
Interestingly, if you think in Lisp, it's obvious how much more elegant Thompson's approach is (than a C struct-based state machine), and how you would implement it in Thompson's way with closures.
- agazso 17y agoIn fact Thompson invented JIT compiling with this in 1968.