> every single language document uses its own notation, which is more often than not, a dialect of the (Extended) Backus-Naur Form
I came across this recently while writing an article that references Lua, Go and Python (3.8) syntax. Each of them uses a slightly different form of EBNF.
To make them more easily comparable, I wanted to convert all three to the same format. Looking for something fairly standard (not entirely ad-hoc but also not as formal as ISO/IEC EBNF or RFC 5234 ABNF), I came across Wirth Syntax Notation [0] [1]:
syntax = { production } .
production = identifier "=" expression "." .
expression = term { "|" term } .
term = factor { factor } .
factor = identifier | literal | "(" expression ")" | "[" expression "]" | "{" expression "}" .
literal = "\"" character {character} "\"" .
It turns out that the Go specification already uses WSN [2]. I converted Lua and Python, and then could work with all three language grammars in a consistent, machine-readable notation.
I came across this recently while writing an article that references Lua, Go and Python (3.8) syntax. Each of them uses a slightly different form of EBNF.
To make them more easily comparable, I wanted to convert all three to the same format. Looking for something fairly standard (not entirely ad-hoc but also not as formal as ISO/IEC EBNF or RFC 5234 ABNF), I came across Wirth Syntax Notation [0] [1]:
It turns out that the Go specification already uses WSN [2]. I converted Lua and Python, and then could work with all three language grammars in a consistent, machine-readable notation.[0] https://en.wikipedia.org/wiki/Wirth_syntax_notation
[1] https://dl.acm.org/doi/10.1145/359863.359883
[2] https://go.dev/ref/spec#Notation