Invoking Alex

Alex User Guide
Prev |  |

# Chapter 6. Invoking Alex

The command line syntax for Alex is entirely standard:

        alex { option } file.x  { option }

Alex expects a single ``file`.x` to be named on the command line. By default, Alex will create ``file`.hs` containing the Haskell source for the lexer.

The options that Alex accepts are listed below:

`-d`, `--debug`

  Causes Alex to produce a lexer which will output debugging messsages as it runs.

`-g`, `--ghc`

  Causes Alex to produce a parser which is optimised for compiling with GHC. The parser will be significantly more efficient, both in terms of the size of the compiled lexer and its runtime.

`-o` `file`, `--output-file`=`file`

  Specifies the filename in which the output is to be placed. By default, this is the name of the input file with the `.x` suffix replaced by `.hs`.

`-i` [`file`], `--info` [`file`]

  Produces a human-readable rendition of the state machine (DFA) that Alex derives from the lexer, in `file` (default: ``file`.info` where the input file is ``file`.x`).

  The format of the info file is currently a bit basic, and not particularly informative.

`-v`, `--version`

  Be more verbose. This currently doesn't do anything, but it might in the future.

Prev | Home |
Wrappers |  |