TY - GEN
T1 - Certified Parsing of Dependent Regular Grammars
AU - Sarracino, John
AU - Tan, Gang
AU - Morrisett, Greg
N1 - Funding Information:
ACKNOWLEDGMENT We thank our paper shepherd, Julien Vanegue, and our anonymous reviewers for excellent feedback on technical content and presentation. This work was supported by DARPA research grant HR0011-19-C-0073.
Publisher Copyright:
© 2022 IEEE.
PY - 2022
Y1 - 2022
N2 - Parsers are ubiquitous, but formal reasoning about the behavior of a parser is challenging. One key challenge is parsing dependent formats, which are difficult for traditional techniques to handle because parse values can influence future parsing behavior. We present dependent regular grammars, which extend regular languages with data-dependency by generalizing concatenation to monadic bind. Even this small tweak adds significant expressive power; for example, conditional parsing and dependent repetition are both implementable using monadic bind.However, it is not obvious how to actually parse dependent regular grammars. We implement a Brzozowski derivative based matching algorithm, and we show how many popular parser combinator functions can be implemented in our library while retaining the same simplicity as traditional parser combinators.We implement and formalize these grammars in Coq, as well as a derivative-based matching algorithm. We prove soundness and completeness of the derivative operator in the standard way. We also implement a variety of popular parser combinator functions and give formal specifications to them. Finally, we implement as a case study a verified netstring parser, and prove functional correctness of the parser.
AB - Parsers are ubiquitous, but formal reasoning about the behavior of a parser is challenging. One key challenge is parsing dependent formats, which are difficult for traditional techniques to handle because parse values can influence future parsing behavior. We present dependent regular grammars, which extend regular languages with data-dependency by generalizing concatenation to monadic bind. Even this small tweak adds significant expressive power; for example, conditional parsing and dependent repetition are both implementable using monadic bind.However, it is not obvious how to actually parse dependent regular grammars. We implement a Brzozowski derivative based matching algorithm, and we show how many popular parser combinator functions can be implemented in our library while retaining the same simplicity as traditional parser combinators.We implement and formalize these grammars in Coq, as well as a derivative-based matching algorithm. We prove soundness and completeness of the derivative operator in the standard way. We also implement a variety of popular parser combinator functions and give formal specifications to them. Finally, we implement as a case study a verified netstring parser, and prove functional correctness of the parser.
UR - http://www.scopus.com/inward/record.url?scp=85136152538&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=85136152538&partnerID=8YFLogxK
U2 - 10.1109/SPW54247.2022.9833893
DO - 10.1109/SPW54247.2022.9833893
M3 - Conference contribution
AN - SCOPUS:85136152538
T3 - Proceedings - 43rd IEEE Symposium on Security and Privacy Workshops, SPW 2022
SP - 113
EP - 123
BT - Proceedings - 43rd IEEE Symposium on Security and Privacy Workshops, SPW 2022
PB - Institute of Electrical and Electronics Engineers Inc.
T2 - 43rd IEEE Symposium on Security and Privacy Workshops, SPW 2022
Y2 - 23 May 2022 through 26 May 2022
ER -