A Verified Operational Semantics for Regular Expression Parsing

  • Elton Máximo Cardoso UFOP
  • Leonardo Vieira dos Santos Reis UFJF
  • Rodrigo Geraldo Ribeiro UFOP


Regular expressions (REs) are pervasive in computing. We use REs in text editors, string search tools (like GNU-Grep) and lexical analysers generators. Most of these tools rely on converting REs to their corresponding finite state machines or use REs derivatives to directly parse an input string. In this work, we investigate the suitability of another approach: instead of using derivatives or generating a finite state machine for a given RE, we developed an operational semantics for parsing regular languages, in such a way that a RE is merely a program executed according to the semantics over the input string. We show that the proposed semantics is sound w.r.t. a standard inductive semantics for RE and that the evidence produced by it denotes a valid parsing result. All of our results are formalized using Coq proof assistant.
Palavras-chave: Operational Semantics, Parsing, Regular Expressions
CARDOSO, Elton Máximo; REIS, Leonardo Vieira dos Santos; RIBEIRO, Rodrigo Geraldo. A Verified Operational Semantics for Regular Expression Parsing. In: SIMPÓSIO BRASILEIRO DE LINGUAGENS DE PROGRAMAÇÃO (SBLP), 27. , 2023, Campo Grande/MS. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2023 . p. 82–90.