PHPackages                             axmachado/pacc - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. axmachado/pacc

ActivePackage[Parsing &amp; Serialization](/categories/parsing)

axmachado/pacc
==============

Parser generator (currently generates recursive descent parser and canonical LR(1) parser) for PHP.

0.2.1(8y ago)714.9k[3 issues](https://github.com/axmachado/pacc/issues)MITPHPPHP &gt;= 5.2.0

Since Aug 4Pushed 8y ago1 watchersCompare

[ Source](https://github.com/axmachado/pacc)[ Packagist](https://packagist.org/packages/axmachado/pacc)[ Docs](https://github.com/axmachado/pacc)[ RSS](/packages/axmachado-pacc/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (6)Used By (0)

pacc – PHP yACC
===============

[](#pacc--php-yacc)

Parser generator (currently generates recursive descent parser and canonical LR(1) parser) for PHP.

Big refactoring from Jakub Kulhan's original pacc.

Get ready
---------

[](#get-ready)

add the `axmachado/pacc` as a *development requirement*:

```
php composer.phar require axmachado/pacc
```

There is executable `bin/pacc`, that is installed by Composer as `vendor/bin/pacc`.

Then, you can run the "pacc" command from your project directory:

```
./vendor/bin/pacc -h
```

Write parsers
-------------

[](#write-parsers)

Files consumed by `pacc` are structured like this:

```
    grammar ;

    option  = ;

    @ {

    }

```

Rules are compiled into PHP parser code, header and footer are left as they are.

`pacc` uses YACC/Bison syntax for rules. Each rule constist of its name, `:`, body, and `;`. Name has to match regular expression `[a-z][a-z_]*`. Body consists of expressions separated by vertical bar – `|`. Each expression can have some attached PHP code. For example:

```
    numerical_operation
        : number '+' number { $$ = $1 + $3; /* $1 is first number, $2 is plus sign, and $3 is second number */ }
        | number '-' number { $$ = $1 - $3; }
        ;
```

In PHP code, you can use special variables like `$$`, `$1`, `$2`, `$3`, etc. In `$$` is saved result of expression. Through numerical variables you get result of subexpressions.

Look for inspiration in `examples/` directory.

License
-------

[](#license)

The MIT license

```
Copyright (c) 2009-2010 Jakub Kulhan
Copyright (c) 2017      Alexandre Machado

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance11

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~18 days

Total

4

Last Release

3196d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/135b75c845fa21062f21ed9e3c8bb26e052bd8bc44573a770c1c950d1f7129ad?d=identicon)[axmachado](/maintainers/axmachado)

---

Top Contributors

[![axmachado](https://avatars.githubusercontent.com/u/1927177?v=4)](https://github.com/axmachado "axmachado (21 commits)")[![jakubkulhan](https://avatars.githubusercontent.com/u/95001?v=4)](https://github.com/jakubkulhan "jakubkulhan (15 commits)")[![bohdankolecek](https://avatars.githubusercontent.com/u/7396096?v=4)](https://github.com/bohdankolecek "bohdankolecek (1 commits)")

### Embed Badge

![Health badge](/badges/axmachado-pacc/health.svg)

```
[![Health](https://phpackages.com/badges/axmachado-pacc/health.svg)](https://phpackages.com/packages/axmachado-pacc)
```

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19037.7M41](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9642.0k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

46143.1k6](/packages/jstewmc-rtf)[moonshine/layouts-field

Field for repeating groups of fields for MoonShine

107.9k](/packages/moonshine-layouts-field)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

112.9k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
