Question

So, it seems like Happy is a robust replacement for yacc in Haskell. Is there an equally robust lexer generator to replace lex/flex?

Was it helpful?

Solution

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...

OTHER TIPS

Happy : Yacc :: Alex : Lex

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top