Version: 0.8.0

Installation & Requirements

composer require parsica-php/parsica

Requirements

(@TODO: add polyfill for mbstring).

Usage

In a .php file, make sure the Composer autoloader is included:

require_once __DIR__.'/../vendor/autoload.php';

Import parsers and combinators:

use function Parsica\Parsica\char;

You can combine multiple imports in one statement:

use function Parsica\Parsica\{between, char, atLeastOne, alphaChar};

Finally, add some code:

<?php
$parser = between(char('{'), char('}'), atLeastOne(alphaChar()));
$result = $parser->tryString("{Hello}");
echo $result->output();
// outputs "Hello"