【文件属性】:
文件名称:parser-utils:一个用PHP编写递归下降解析器的库
文件大小:15KB
文件格式:ZIP
更新时间:2021-05-09 22:53:27
php parser lexer recursive-descent-parser PHP
一个用PHP编写库。
要求
PHP> = 7.1
安装
首选的安装方法是 :
composer require yosymfony/parser-utils
一个例子
首先,您需要创建一个词法分析器。 这将识别令牌
use Yosymfony \ ParserUtils \ BasicLexer ;
$ lexer = new BasicLexer ([
'/^([0-9]+)/x' => 'T_NUMBER' ,
'/^(\+)/x' => 'T_PLUS' ,
'/^(-)/x' => 'T_MINUS' ,
'/^\s+/' => 'T_SPACE' , // We do not surround it with parentheses because
// this is not meani
【文件预览】:
parser-utils-master
----composer.json(759B)
----.travis.yml(217B)
----tests()
--------AbstractParserTest.php(2KB)
--------TokenStreamTest.php(7KB)
--------TokenTest.php(681B)
--------BasicLexerTest.php(4KB)
----LICENSE(1KB)
----src()
--------TokenStream.php(3KB)
--------Token.php(1KB)
--------TokenStreamInterface.php(2KB)
--------BasicLexer.php(5KB)
--------SyntaxErrorException.php(1KB)
--------AbstractParser.php(1KB)
--------LexerInterface.php(571B)
----.gitignore(52B)
----CHANGELOG.md(373B)
----phpunit.xml.dist(562B)
----README.md(5KB)