因此,看起来在Haskell中,Happy似乎是yacc的一个强有力的替代品。是否存在同样强大的词法分析器生成器来替换lex/flex?
Alex? http://www.haskell.org/alex/
a tool for generating lexical analysers in Haskell, given a description of the tokens to be recognised in the form of regular expressions. It is similar to the tool lex or flex for C/C++...
Alex is part of the Haskell Platform, so if you install the platform you will automatically have a working Alex.
Alex is also on Hackage. If you have the cabal-install tool (which also comes with the Haskell Platform), then you can build and install the latest version of Alex with
cabal install alex
To find out what the latest version of Alex is, and to download the source separately, go to Alex's HackageDB page.
Alex might also be pre-packaged for your OS...
快乐:Yacc :: Alex : Lex
或者使用数以亿计的解析器和词法分析器组合库。