Interval Parsing Grammars for File Format Parsing
Jialun Zhang, Greg Morrisett, Gang Tan
Abstract
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.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 7a2c2b98-e949-4fc1-bfd7-b1f37361303bBuilds on1
Related papers
- CoStar: a verified ALL(*) parserSam Lasser, Chris Casinghino, Kathleen Fisher, Cody RouxPLDI 2021 · 10 citations
- Saggitarius: A DSL for Specifying Grammatical DomainsAnders Miltner, Devon Loehr, Arnold Mong, Kathleen Fisher et al.OOPSLA 2023 · 1 citation
- Daedalus: Safer Document ParsingIavor S. Diatchki, Mike Dodds, Harrison Goldstein, Bill Harris et al.PLDI 2024 · 4 citations
- Input invariantsDominic Steinhöfel, Andreas ZellerFSE 2022 · 47 citations
- Lifting Network Protocol Implementation to Precise Format Specification with Security ApplicationsQingkai Shi, Junyang Shao, Yapeng Ye, Mingwei Zheng et al.CCS 2023 · 15 citations
