A play on regular expressions: functional pearl
A play on regular expressions: functional pearl
复制标题
正则表达式的游戏:功能性珍珠
DOI:
--
复制
发表时间:
2010
期刊:
影响因子:
--
通讯作者:
T. Wilke
中科院分区:
文献类型:
--
作者:
Sebastian Fischer;F. Huch;T. Wilke
Cody, Hazel, and Theo, two experienced Haskell programmers and an expert in automata theory, develop an elegant Haskell program for matching regular expressions: (i) the program is purely functional; (ii) it is overloaded over arbitrary semirings, which not only allows to solve the ordinary matching problem but also supports other applications like computing leftmost longest matchings or the number of matchings, all with a single algorithm; (iii) it is more powerful than other matchers, as it can be used for parsing every context-free language by taking advantage of laziness.
The developed program is based on an old technique to turn regular expressions into finite automata which makes it efficient both in terms of worst-case time and space bounds and actual performance: despite its simplicity, the Haskell implementation can compete with a recently published professional C++ program for the same problem.