pratt:Python Pratt Parser 实现

时间:2021-06-11 11:35:23
【文件属性】:
文件名称:pratt:Python Pratt Parser 实现
文件大小:25KB
文件格式:ZIP
更新时间:2021-06-11 11:35:23
Python 普拉特 Pratt 是一个用于创建 Pratt 解析器的 Python 库。 Pratt 解析器是递归下降运算符优先级解析器。 这样的解析器非常适合解析表达式并很好地集成到常规递归下降解析器中。 使用 Pratt 的最小解析器如下所示: from pratt import Grammar, Parser def get_token_type(token): return token[0] def handle_unexpected_token(token): # Custom exception type omitted for brevity raise SyntaxErrror('oops: {!r}'.format(token)) grammar = Grammar(get_token_type=lambda token: token[0] grammar
【文件预览】:
pratt-master
----setup.py(1KB)
----.gitignore(36B)
----pratt.py(12KB)
----LICENSE.rst(2KB)
----.travis.yml(310B)
----examples()
--------math_expr.py(4KB)
----test_pratt.py(8KB)
----README.rst(2KB)
----test_examples.py(1KB)
----CHANGELOG.rst(617B)
----docs()
--------Makefile(7KB)
--------api.rst(280B)
--------tutorial-step-1-algorithm.rst(2KB)
--------index.rst(228B)
--------conf.py(9KB)
--------_static()
--------installation.rst(568B)
--------make.bat(7KB)
--------tutorial-step-2-implementation.rst(6KB)
--------changelog.rst(30B)
--------license.rst(28B)
--------tutorial.rst(281B)
--------foreword.rst(736B)
--------tutorial-step-3-abstraction.rst(1KB)
----tox.ini(268B)

网友评论