Command line
============

Usage::

  pacc [OPTION]... FILE
  foo

**pacc** must be invoked with the name of a grammar file, which
conventionally has a ``.pacc`` extension. It will write an output file
with the same name but a ``.c`` extension.

Option summary::

  Operation modes
    -h, --help               display this help and exit
    -v, --version            report version number and exit
    -D, --dump-ast=WHEN      dump the parse tree at various points
  
  Parser:
    -f, --feed=FILE          write extra feed parser to FILE
    -r, --feed-rule=RULE     end-of-input rule when feeding (default: __)
  
  Output:
    -d, --defines[=FILE]     also produce a header file
    -o, --output=FILE        write output to FILE


Output options
--------------

Some options control the output of **pacc**.

``--output=FILE``
  With the option ``-oFILE`` or ``--output=FILE``, **pacc** will write
  its output to the named FILE. Since **pacc**'s output is **C** source
  code, you probably want to specify a FILE with a ``.c`` extension.
``-defines[=FILE]``
  With the option ``-d`` or ``--defines``, **pacc** will additionally
  write a header file, containing external definitions. If no FILE is
  specified, the defines file will have the same name as the input file
  but with a ``.h`` extension.

Parser options
--------------

Some options control the parser that **pacc** generates.

``--feed=FILE``
  With the option ``-f`` or ``--feed``, **pacc** writes an extra *feed*
  parser to the named file. This can be used for parsing command line
  input where some lines are correct but incomplete. If the main parser
  returns an error, but the feed parser recognises the input, the
  controlling program should solicit more input from the user,
  and “feed” it to the parser.
  
``--feed-rule=RULE``
  Feeding requires a RULE to indicate places in the grammar where the
  end of input is allowed to occur in a partial input. If feeding is
  enabled with ``--feed=FILE``, but no *feed rule* is specified, the
  default feed rule is ``__`` (two underscores).

Help options
------------

The usual help options are supported.

``--help``
  If the ``-h`` or ``--help`` option is specified, **pacc** writes a
  short description of its command line usage and options to standard
  output, then exits.
``--version``
  If the ``-v`` or ``--version`` option is specified, **pacc** writes
  version information and its copyright statement to standard output,
  then exits.

Debug options
-------------

Some options can help with debugging **pacc** itself.

``--dump-ast=WHEN``
  If the ``-D`` or ``--dump-ast`` option is specified, **pacc** will
  write a dump of the Abstract Syntax Tree representation. The WHEN
  string specifies various points at which the AST will be dumped: if it
  contains the character ``0`` the tree will be dumped as soon as the
  input grammar has been parsed; ``1`` dumps the tree after desugaring;
  ``2`` dumps the tree after “cooking” (preparing the grammar for
  feeding with the ``-f`` flag). Multiple dumps can be specified, e.g.
  ``-D02``.
