Skip to Main Content
Talk Intermediate GPL-3.0 license First Talk

Making Grammar fun Again

Proposal status is Review Pending
Session Description

I wanted to build a Monkeytype like speedtyping platform for developers. The problem was that we needed a way to generate the code snippets which should be structurally correct and resemble the correct language very very fast.

A database of real snippets doesn’t scale, and random tokens aren’t code. So I built Resrap, a tool that takes a grammar and generates infinite, structurally valid code from it, a parser in reverse. This talk is the story of chasing that problem into EBNF, discovering its limitations in code generation, and inventing new operators (infinite generation, weighted probabilities, seeded determinism) to make it actually work.

Key Takeaways
  • Introduction to BNF/EBNF and where their basic operators fall short

  • How a reverse parser works: walking a grammar as a graph instead of validating against one

  • Using PRNG and seeding to make generation deterministic and reproducible

  • Freezing graphs: using immutable data structures to get lock-free concurrent reads

References

Session Categories

Introducing a FOSS project or a new version of a popular project
Talk License: GPL-3.0 license

Speakers

Arnav Sharma
Arnav Sharma OSDC Senior Coordinator | OSDC

Heyo, I am Arnav, addicted to reinventing the wheel. I have dabbled in Backend and Systems primarily in Golang. Additionally, I enjoy doing random Photoshops and Asserto Corsa.

Reviews

No reviews yet.