Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I like railroad diagrams for language grammars. So much easier than just looking at production rules.

https://en.wikipedia.org/wiki/Syntax_diagram

They're used at https://json.org/, for example.



I also love railroad diagrams! I taught them briefly as part of CS61A at Berkeley last year, when we were learning BNF/Scheme/Interpreters.

https://inst.eecs.berkeley.edu/~cs61a/sp21/assets/slides/33-...

They're used in the SQLite docs as well, where I think they're really well suited.


Agreed. I find the SQLite diagrams very helpful. They are generated with Pikchr, which itself was created by the SQLite developers I believe:

https://pikchr.org/home/doc/trunk/doc/sqlitesyntax.md


The Apple Pascal poster has a very 70s vibe: https://www.whatisepic.it/wp-content/uploads/2022/05/apple_p...


It's not very useful as a technical reference. The text is so de-emphasized in comparison to the graph, it's impossible to read.


> Instead of learning how Raskin’s color scheme worked, Jobs hired an artist, San Francisco’s Tom Kamifuji, who was a hot, up-and-coming artist in the late 70’s / early 80’s. Jobs gave him free reign to make it more artistic, though Jobs failed to explain that the original color scheme was important for using the chart easily.

https://vintagecomputer.ca/the-history-of-apples-pascal-synt...


There is a generator for railroad diagrams on GitHub:

https://github.com/GuntherRademacher/rr


SQLite also uses them on the website.

Bit of a discussion on how they're created here: https://wiki.tcl-lang.org/page/Generating+Syntax+Diagrams+Us...


Ah they are called railroad diagrams, it makes sense. I first saw the in sqlite documentation [1]. Thanks for giving them a name!

[1] https://www.sqlite.org/lang_select.html


Another place that uses this style of diagram is the original JSON spec.

https://www.json.org/json-en.html


railroad diagrams for regular expressions: https://www.debuggex.com


I learned Pascal with these, which seemed to be all the rage in the 80's, or for Pascal, or the intersection of them.

SQLITE uses them now as well: https://www.sqlite.org/lang_aggfunc.html


I would like to see a lot more of them in the world, as interactive tools as well as simply diagrams. I think they would make a great basis for a UI to design multi-step async processes where things can fail at any point and you want to handle different failures differently.


Love these for finite state machines - one of my favourite topics at uni.


It's strange that most of the times, they just confuse me more. I'd prefer just looking at the BNF grammar...



It's my favorite, too!


Yes, I love these!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: