Thanks to Pradyun for recommending the wonderful railroad-diagrams library!
There’s much work to be done simplifying the diagrams. The current docs remove invalid_ rules, lookaheads, cuts and forced tokens. Nowadays we can also remove TYPE_COMMENT.
And then, there’s duplication to be removed – for a simple example:
for_stmt:
| 'for' star_targets 'in' ~ star_expressions ':' [TYPE_COMMENT] block [else_block]
| ASYNC 'for' star_targets 'in' ~ star_expressions ':' [TYPE_COMMENT] block [else_block]
can become much more readable:
or with_stmt:
can turn into:
We probably can’t match the quality of the hand-crafted diagrams Pascal had, but I still believe we can get something helpful enough to publish.
More examples & info on current work in progress: https://hackmd.io/W2oskTZ9TxOICixcPtVXGg?view



