GuntherRademacher / rr

RR - Railroad Diagram Generator
Apache License 2.0
467 stars 51 forks source link

It would be nice to allow textual annotations in the grammar #15

Open pvillads opened 2 years ago

pvillads commented 2 years ago

A language of any complexity is not just defined by its syntax, but also its semantics. Currently there is no way to annotate (or describe) the grammar rules in natural language. Consider a rule defining integer literals:

IntegerLiteral = digit+

It is certainly correct, but the reader needs to know that what the maximum allowed literal is. It would be very nice to be able to generate:

IntegerLiteral = digit+ // Integer literals may not exceed unsigned values in 32 bits.

The text in comments should be provided (just like you can do for the actual grammar rule) in the generated HTML.

I realize that you get away with using the -png option and then merging the generated HTML file with the comments, but it is a hassle to maintain.