pacc logo
pacc v0.3: Invoking pacc

Next: , Up: User manual   [Contents][Index]


21.1 Invoking pacc

Usage:

pacc [OPTION]... FILE

pacc must be invoked with the name of a grammar file, which conventionally has a .pacc extension. pacc 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: 
  -n, --name=NAME          name the grammar (default: pacc)
  -f, --feed=FILE          write extra feed parser to FILE

Output:
  -d, --defines[=FILE]     also produce a header file
  -o, --output=FILE        write output to FILE

21.1.1 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 should specify a FILE that has 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 output file but with a .h extension.

21.1.2 Parser options

Some options control the parser (or parsers) that pacc generates.

--name=NAME

The parser created by pacc is interfaced to your C program through a number of functions with names such as ‘pacc_new()’ (see Interfaces). When the ‘-nNAME’ or ‘--name=NAME’ option is specified, the functions are instead named ‘NAME_new()’.

--feed=FILE

With the option ‘-fFILE’ or ‘--feed=file’, 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 (see Feeding). 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.

21.1.3 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.

21.1.4 Debug options

Some options can help with debugging pacc itself.

--dump-ast=WHEN

If the ‘-DWHEN’ or ‘--dump-ast=WHEN’ 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’.


Next: , Up: User manual   [Contents][Index]

Last updated: 2016-08-03 21:39:50 UTC

News

Porting and packaging

One thing pacc needs is more users. And, perhaps, one way to get more users is to reduce the friction in getting started with pacc. An obvious lubricant is packaging. Read More...

Release relief

Looking at _pacc_coords(), I noticed that it seemed to have the same realloc() bug that I'd just fixed in _pacc_result(). However, the "list of arrays" trick really wasn't going to work here. Read More...

See more news articles

feed