简体   繁体   中英

Haskell parsing tools - yacc:lex :: happy:?

So, it seems like Happy is a robust replacement for yacc in Haskell. Is there an equally robust lexer generator to replace 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...

Happy : Yacc :: Alex : Lex

Or use one of a gazillion parser and lexer combinator libraries.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM