arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2304.04859cs.PL
收藏

用于文件格式解析的区间解析文法

Interval Parsing Grammars for File Format Parsing

Jialun Zhang, Greg Morrisett, Gang Tan

AI总结:

针对文件格式中的上下文敏感模式,本文提出区间解析文法IPG,通过区间与属性连接支持规范描述,并形式化语法语义以生成递归下降解析器,且在多种真实文件格式上验证。

摘要:

文件格式规定了数据如何编码以进行持久化存储。它们不能被形式化为上下文无关文法,因为其规范包含随机访问模式和类型-长度-值模式等上下文敏感模式。我们提出了一种称为区间解析文法(Interval Parsing Grammars,IPGs)的新文法机制,用于文件格式规范。IPG为每个非终结符/终结符附加一个区间,该区间指定非终结符/终结符所消耗的输入范围。通过连接区间和属性,可以很好地处理文件格式中的上下文敏感模式。在本文中,我们形式化了IPG的语法及其语义,并且其语义自然地产生了一个解析器生成器,该生成器可从IPG生成递归下降解析器。总体而言,IPG是声明式、模块化的,并支持终止性检查。我们已使用IPG规范了多种文件格式,包括ZIP、ELF、GIF、PE和部分PDF;我们还评估了所生成解析器的性能。

英文摘要:

File formats specify how data is encoded for persistent storage. They cannot be formalized as context-free grammars since their specifications include context-sensitive patterns such as the random access pattern and the type-length-value pattern. We propose a new grammar mechanism called Interval Parsing Grammars IPGs) for file format specifications. An IPG attaches to every nonterminal/terminal an interval, which specifies the range of input the nonterminal/terminal consumes. By connecting intervals and attributes, the context-sensitive patterns in file formats can be well handled. In this paper, we formalize IPGs' syntax as well as its semantics, and its semantics naturally leads to a parser generator that generates a recursive-descent parser from an IPG. In general, IPGs are declarative, modular, and enable termination checking. We have used IPGs to specify a number of file formats including ZIP, ELF, GIF, PE, and part of PDF; we have also evaluated the performance of the generated parsers.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑