# Happy User Guide

### Simon Marlow

### Andy Gill

Copyright © 1997-2001 by Simon Marlow

This document describes Happy, the Haskell Parser Generator, version 1.14.

Table of Contents
1. Introduction
  1.1. Compatibility
  1.2. Reporting Bugs
  1.3. License
  1.4. Obtaining Happy
2. Using Happy
  2.1. Returning other datatypes
  2.2. Parsing sequences
    2.2.1. Sequences with separators
  2.3. Using Precedences
    2.3.1. How precedence works
    2.3.2. Context-dependent Precedence
  2.4. Type Signatures
  2.5. Monadic Parsers
    2.5.1. Handling Parse Errors
    2.5.2. Threaded Lexers
    2.5.3. Line Numbers
    2.5.4. Summary
  2.6. The Error Token
  2.7. Generating Multiple Parsers From a Single Grammar
3. Invoking Happy
4. Syntax of Grammar Files
  4.1. Lexical Rules
  4.2. Module Header
  4.3. Directives
    4.3.1. Token Type
    4.3.2. Tokens
    4.3.3. Parser Name
    4.3.4. Monad Directive
    4.3.5. Lexical Analyser
    4.3.6. Precedence declarations
  4.4. Grammar
  4.5. Module Trailer
5. Info Files
6. Tips
  6.1. Performance Tips
  6.2. Compilation-Time Tips
  6.3. Finding Type Errors
  6.4. Conflict Tips
    6.4.1. LALR(1) parsers
  6.5. Using Happy with GHCi

|  | Next
|  | Introduction