The Phug parser utilizes the Phug lexer and parses the tokens it generates into an AST
Install via Composer
composer require phug/parser
$parser = new Phug\Parser($options);
$root = $parser->parse($pugInput);
//$root is now a Phug\Parser\Node\DocumentNode element