Paper 2024/562 Original: eprint.iacr.org/2024/562 ↗

Practical Proofs of Parsing for Context-free Grammars

Harjasleen Malvai
Siam Hussain
Gregory Neven
Andrew Miller
Abstract

We present a scheme to prove, in zero-knowledge (ZK), the correct parsing of a string in context-free grammar (CFG). This is a crucial step towards applications such as proving statements about web API responses in ZK. To the best of our knowledge, this is the first ZK scheme to prove the correctness of CFG parsing with complexity linear in the length of the string. Further, our algorithm flexibly accommodates different ZK proof systems. We demonstrate this flexibility with multiple implementations using both non-interactive and interactive proof paradigms. Given general-purpose ZK programming frameworks, our implementations are not only compact (e.g., around 200 lines of code for the non-interactive version) but also deliver competitive performance. In the non-interactive setting, proving the correct parsing of a $\approx 1$KB string takes 24 seconds, even for grammars with $2^{10}$ production rules. In the interactive setting the same proof takes just 1.6 seconds.

Metadata
Available format(s)
PDF
Category
Applications
Publication info
Preprint.
History
2024-09-27: last updated
2024-04-11: published
Short URL
https://ia.cr/2024/562
License
https://creativecommons.org/licenses/by/4.0/

BibTeX

@misc{cryptoeprint:2024/562,
      author = {Harjasleen Malvai and Siam Hussain and Gregory Neven and Andrew Miller},
      title = {Practical Proofs of Parsing for Context-free Grammars},
      howpublished = {Cryptology {ePrint} Archive, Paper 2024/562},
      year = {2024},
      url = {https://eprint.iacr.org/2024/562}
}
Note: In order to protect the privacy of readers, this archive does not use cookies or embedded third party content.