PHPackages                             gene-sis/lime - 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. gene-sis/lime

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

gene-sis/lime
=============

Lime parser generator

2.0.0(9y ago)1471PHPPHP &gt;=5.3.0

Since Nov 20Pushed 9y agoCompare

[ Source](https://github.com/gene-sis/lime)[ Packagist](https://packagist.org/packages/gene-sis/lime)[ RSS](/packages/gene-sis-lime/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

Lime: An LALR(1) parser generator in and for PHP.
=================================================

[](#lime-an-lalr1-parser-generator-in-and-for-php)

*Interpreter pattern got you down? Time to use a real parser? Welcome to Lime.*

1. Use composer to install Lime.

    `composer require gene-sis/lime`
2. Build lime\_scan\_tokens for your development OS.

    For Windows run `flex -t vendor\gene-sis\lime\scanner\lime_scan_tokens.l > vendor\gene-sis\lime\scanner\lime_scan_tokens.c`and `gcc vendor\gene-sis\lime\scanner\lime_scan_tokens.c -o vendor\gene-sis\lime\scanner\lime_scan_tokens.exe`from the command line.
3. Write a grammar file

    Lime uses slightly modified and tweaked Backus-Naur forms. You can look at the .lime examples in the folder /vendor/gene-sis/lime/examples to understand the grammar.

    You can refer to your components by numbers the way BISON demands `	exp =	exp '+' exp { $$ = $1 + $3; );`or assign symbolic names (similar to C-based "Lemon" parser from which Lime derives its name) `	exp =	exp/a '+' exp/b { $$ = $a + $b; );`Oh, and one other thing: symbols are terminal if the scanner feeds them to the parser. They are non-terminal if they appear on the left side of a production rule. Lime names semantic categories using strings instead of the numbers that BISON-based parsers use, so you don't have to declare any list of terminal symbols anywhere.
4. Defined pragmas

    - %namespace define the namespace of your parser file (enclose in single quotes) e.g. `%namespace 'YourProject\Extensions\Lime'`
    - %class define the class name of your parser
    - %start define the start symbol of your grammar
    - %left
    - %right
    - %nonassoc
    - %expect
5. Build your parser

    php /vendor/gene-sis/lime/lime.php path/to/your/grammar/file.lime &gt; MyParser.php
6. Integrate your parser into your project

```
	// below the namespace
	use YourProject\Extensions\Lime\MyParser;
	use Genesis\Lime\ParseEngine;
	use Genesis\Lime\ParseError;

	// create the parser instance
	$parser = new ParseEngine( new MyParser() );

	// run the parser
	try {
		// reset the parser
		$parser->reset();

		// tokenize your input with a suitable function/method and feed the
		// tokens to the parser
		foreach( tokenize( $input ) as $token ) {
			$parser->eat( $token['type'], $token['value'] );
		}

		// get the result
		$result = $parser->eat_eof();

	} catch ( ParseError $e ) {
		// handle parse errors
		$error = $e->getMessage();
	}
```

7. You now have the computed semantic value of whatever you parsed. Add salt and pepper to taste, and serve.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

3459d ago

### Community

---

Top Contributors

[![gene-sis](https://avatars.githubusercontent.com/u/23010567?v=4)](https://github.com/gene-sis "gene-sis (8 commits)")

### Embed Badge

![Health badge](/badges/gene-sis-lime/health.svg)

```
[![Health](https://phpackages.com/badges/gene-sis-lime/health.svg)](https://phpackages.com/packages/gene-sis-lime)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

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