As CockroachDB nears its beta release, documenting its SQL implementation has become crucial, particularly through the use of intuitive grammar diagrams. Inspired by SQLite’s effective use of railroad diagrams, the author sought to create similar visuals for CockroachDB using a combination of yacc, EBNF, and various conversion tools, such as the Railroad Diagram Generator. The process involved converting the existing SQL grammar from yacc files into EBNF format, refining the diagrams for usability by inlining and simplifying complex statements, and filtering out unimplemented SQL expressions to maintain accuracy. This approach allows for the automatic generation of SQL diagrams, which are easily navigable and updateable, enhancing the overall documentation and user experience.