LEPL递归解析器
LEPL是一个用 Python 开发的向下递归解析器。It is based on parser combinator libraries popular in functional programming, but also exploits Python language features. Operators provide a friendly syntax, and the consistent use of generators supports full backtracking and resource management. Backtracking implies that a wide variety of grammars are supported; appropriate memoisation ensures that even left-recursive grammars terminate.
>>> from lepl import *
>>> class Term(Node): pass
>>> class Factor(Node): pass
>>> class Expression(Node): pass
>>> expr = Delayed()
>>> number = Digit()[1:,...] > 'number'
>>> spaces = Drop(Regexp(r'\s*'))
>>> with Separator(spaces):
>>> term = number | '(' & expr & ')' > Term
>>> muldiv = Any('*/') > 'operator'
>>> factor = term & (muldiv & term)[:] > Factor
>>> addsub = Any('+-') > 'operator'
>>> expr += factor & (addsub & factor)[:] > Expression
>>> line = expr & Eos()
>>> parser = line.parse_string
>>> parser('1 + 2 * (3 + 4 - 5)')[0]
Expression
+- Factor
| +- Term
| | `- number '1'
| `- ' '
+- operator '+'
+- ' '
`- Factor
+- Term
| `- number '2'
+- ' '
+- operator '*'
+- ' '
`- Term
+- '('
+- Expression
| +- Factor
| | +- Term
| | | `- number '3'
| | `- ' '
| +- operator '+'
| +- ' '
| +- Factor
| | +- Term
| | | `- number '4'
| | `- ' '
| +- operator '-'
| +- ' '
| `- Factor
| `- Term
| `- number '5'
`- ')
评论
Soul Parsing Framework递归下降解析器生成器
Soul是一个递归下降解析器生成器工具适用于Windows和Linux的解析库的陪同下。它具有C++和C#绑定。在C++工具被称为soul2cpp和C#工具soul2cs的的。
Soul Parsing Framework递归下降解析器生成器
0
TouchJSONJSON 解析器
TouchJSON是Objective-C的JSON解析器,支持OS X和 iOS设备。基于JonathanWight的CocoaJSON http://toxicsoftware.com/cocoa
TouchJSONJSON 解析器
0
HtmlAgilityPackhtml解析器
HtmlAgilityPack是CodePlex上的一个开源项目。它提供了标准的DOMAPI和XPath导航--即使HTML不是适当的格式!示例代码:HtmlDocumentdoc=newHtmlDo
HtmlAgilityPackhtml解析器
0
PC-BASICGW-BASIC 解析器
PC-BASIC是一个GW-BASIC文件解析器,可以运行和转换ASCII,字节码和“protected”(加密)的.BAS文件。它继承了MicrosoftBinaryFormat(MBF)的浮点算法
PC-BASICGW-BASIC 解析器
0