Open a-recknagel opened 4 years ago
Bearing in mind that I have not much of a clue, a couple of things caught my interest:
Unnamed x
. Is it possible to give them a meaningful name?KEYWORDS
node, the elements 'True'
and 'False'
appear twice, albeit in slightly different configurationsUnnamed 2
and [NAME ':'] TYPE
TYPE
is so sequential. I would have imagined it to be a little more branch-y, similar to TYPE_exclude_UNION
'(' TYPE {',' TYPE} [',' '...'] ')'
, '[' TYPE ']'
, '{' TYPE ':' TYPE '}'
and '{' TYPE '}'
implicit or explicit?pinging @maxfischer2781, in case this is interesting for you.
That's both nice and kind of embarrassing. Looks like re-organising could help both the parser and humans.
async
nodes could be one group.Unnamed x
would do well with names.The nodes '[' TYPE ']'
and similar are explicitly named as such. This renders better in error messages.
A while back, I tried to gain an in-depth understanding of what exactly happens in
backend/grammar.py
, but never felt like I really got the hang of it. Since pyparsing now offers railroad diagrams, I thought I'd try again. From pyparsing3.0.0a2 onward (with the [diagrams] extension installed), the following can be run to generate stenotype's grammar railroad:Which should get us the following:
This issue can be used to discuss the current shape of the grammar.
Ultimately, it might be nice to extend the current grammar documentation with this graph (or partial reproductions thereof).