Leandros / PackCC

PackCC is a packrat parser generator for C.
https://leandros.github.io/PackCC
MIT License
22 stars 5 forks source link
c parser-generator recursive-descent

PackCC

PackCC is a packrat parser generator for C. Its defining features are:

Some additional features include:

The algorithm is based on the paper "Packrat Parsers Can Support Left Recursion" authored by A. Warth, J. R. Douglass, and T. Millstein.

Installation

PackCC consists of just a single compact source file packcc.c. To create the executable, just compile it:

cc -o packcc src/packcc.c

Usage

You must prepare a PEG source file (see the documentation). In our example the file is named example.peg:

packcc example.peg

By running this, the files example.h and example.c are generated.

If no PEG file name is specified, the PEG source is read from the standard input, and -.h and -.c are generated.

The base name of the parser source files can be changed by -o option.

packcc -o parser example.peg

By running this, the files parser.h and parser.c are generated.

Documentation

The docs/ directory contains the full documentation.

Alternatively, the full docs can be found at https://leandros.github.io/PackCC

License

MIT License

Copyright (c) 2014 Arihiro Yoshida Copyright (c) 2017 Arvid Gerstmann