LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

happy

parser generator for Haskell, similar to yacc for C

TLDR

Generate parser from grammar
$ happy [grammar.y] -o [Parser.hs]
copy
Generate with info file
$ happy -i [grammar.y]
copy
Show version
$ happy --version
copy
Generate with GHC extensions
$ happy -g [grammar.y]
copy

SYNOPSIS

happy [options] file

DESCRIPTION

Happy is a parser generator for Haskell, similar to yacc for C. It takes a grammar specification and produces a Haskell parser module.
The tool generates LALR parsers from BNF-like grammars. It integrates with Alex lexer generator for complete parsing solutions.

PARAMETERS

FILE

Grammar file (.y).
-o FILE
Output file name.
-i
Generate info file.
-g
Use GHC extensions for faster parsers.
-a
Generate array-based parser (smaller but slower).
-c
Generate GHC-specific parser using GHC primitives.
--help
Display help information.

CAVEATS

Haskell specific. Learning curve for grammar syntax. Debugging shift/reduce conflicts.

HISTORY

Happy was created for Haskell as an equivalent to yacc/bison, widely used in Haskell compilers and tools like GHC.

SEE ALSO

alex(1), ghc(1), yacc(1), bison(1)

Copied to clipboard
Kai