alex

Alex is a tool for generating lexical analysers in Haskell

http://www.haskell.org/alex/

Version on this page:3.2.1
LTS Haskell 22.13:3.4.0.1
Stackage Nightly 2024-03-14:3.5.1.0
Latest on Hackage:3.5.1.0

See all snapshots alex appears in

BSD-3-Clause licensed by Chris Dornan and Simon Marlow
Maintained by Simon Marlow
This version can be pinned in stack with:alex-3.2.1@sha256:a2bc1ec7fc5c19c425770ef153dbbac613f3a2baa80b14a6aff17ad41766d5d1,3298

Module documentation for 3.2.1

There are no documented modules for this package.

Alex: A Lexical Analyser Generator

Build Status

Alex is a Lex-like tool for generating Haskell scanners. For complete documentation, see the doc directory.

http://www.haskell.org/alex/

http://hackage.haskell.org/package/alex

Alex is built using Cabal. First install GHC and cabal-install, then:

$ cabal configure
$ cabal build
$ cabal install

Alex version 2.0 has changed fairly considerably since version 1.x, and the syntax is almost completely different. For a detailed list of changes, see the release notes in the documentation.

Alex is now covered by a BSD-Style licence; see the licence file in the ‘doc’ directory for details.

The sources are in the ‘src’ directory and the documentation in the ‘doc’ directory; various examples are in the ‘examples’ subdirectory.

The source code in the ‘src’ and ‘examples’ directories is intended for a Haskell 98 compiler with hierarchical modules. It should work with GHC >= 5.04.

Please report any bugs or comments at https://github.com/simonmar/alex/issues

Share and enjoy,

Chris Dornan: [email protected]

Isaac Jones: [email protected]

Simon Marlow: [email protected]

Changes

Changes in 3.2.1:

  • Fix build problem with GHC; add new test tokens_scan_user.x

Changes in 3.2.0:

  • Allow the token type and productions to be overloaded, and add new directives: %token, %typeclass, %action. See “Type Signatures and Typeclasses” in the manual.
  • Some small space leak fixes

Changes in 3.1.7:

  • Add support for %encoding directive (allows to control --latin1 from inside Alex scripts)
  • Make code forward-compatible with in-progress proposals
  • Suppress more warnings

Changes in 3.1.6:

  • sdist for 3.1.5 was mis-generated, causing it to ask for Happy when building.

Changes in 3.1.5:

  • Generate less warning-laden code, and suppress other warnings.
  • Bug fixes.

Changes in 3.1.4:

  • Add Applicative/Functor instances for GHC 7.10

Changes in 3.1.3:

  • Fix for clang (XCode 5)

Changes in 3.1.2:

  • Add missing file to extra-source-files

Changes in 3.1.1:

  • Bug fixes (#24, #30, #31, #32)

Changes in 3.1.0:

  • necessary changes to work with GHC 7.8.1

Changes in 3.0 (since 2.3.5)

  • Unicode support (contributed mostly by Jean-Philippe Bernardy, with help from Alan Zimmerman).

    • An Alex lexer now takes a UTF-8 encoded byte sequence as input (see Section 5.1, “Unicode and UTF-8”. If you are using the “basic” wrapper or one of the other wrappers that takes a Haskell String as input, the string is automatically encoded into UTF-8 by Alex. If your input is a ByteString, you are responsible for ensuring that the input is UTF-8 encoded. The old 8-bit behaviour is still available via the –latin1 option.

    • Alex source files are assumed to be in UTF-8, like Haskell source files. The lexer specification can use Unicode characters and ranges.

    • alexGetChar is renamed to alexGetByte in the generated code.

    • There is a new option, --latin1, that restores the old behaviour.

  • Alex now does DFA minimization, which helps to reduce the size of the generated tables, especially for lexers that use Unicode.