An invocation of Happy has the following syntax:
$ happy [ options ] filename [ options ]
All the command line options are optional (!) and may occur either before or after the input file name. Options that take arguments may be given multiple times, and the last occurrence will be the value used.
There are two types of grammar files,
the latter observing the reverse comment (or literate) convention
(i.e. each code line must begin with the character
>, lines which don't begin with
> are treated as comments). The examples
distributed with Happy are all of the
The flags accepted by Happy are as follows:
Specifies the destination of the generated parser module.
If omitted, the parser will be placed in
file is the name of the input
file with any extension removed.
Directs Happy to produce an info file
containing detailed information about the grammar, parser
states, parser actions, and conflicts. Info files are vital
during the debugging of grammars. The filename argument is
optional (note that there's no space between
-i and the filename in the short
version), and if omitted the info file will be written to
file is the input file name with any
Instructs Happy to use this directory when looking for template files: these files contain the static code that Happy includes in every generated parser. You shouldn't need to use this option if Happy is properly configured for your computer.
Happy prefixes all the symbols it uses internally
Happy. To use a
different string, for example if the use of
is conflicting with one of your own functions, specify the
prefix using the
--strict option is
experimental and may cause unpredictable results.
This option causes the right hand side of each
production (the semantic value) to be evaluated eagerly at
the moment the production is reduced. If the lazy behaviour
is not required, then using this option will improve
performance and may reduce space leaks. Note that the
parser as a whole is never lazy - the whole input will
always be consumed before any input is produced, regardless
of the setting of the
Instructs Happy to generate a parser that uses GHC-specific extensions to obtain faster code.
unsafeCoerce# extension to
generate smaller faster parsers. Type-safety isn't
This option may only be used in conjuction with
Instructs Happy to generate a parser
using an array-based shift reduce parser. When used in
-g, the arrays will be
encoded as strings, resulting in faster parsers. Without
-g, standard Haskell arrays will be
Generate a parser that will print debugging
stderr at run-time,
including all the shifts, reductions, state transitions and
token inputs performed by the parser.
This option can only be used in conjunction with
Print usage information on standard output then exit successfully.
Print version information on standard output then exit
successfully. Note that for legacy reasons
is supported, too, but the use of it is deprecated.
-v will be used for verbose mode when it is