Provide a formal grammar for type expressions
Theme Improve interoperability
Description
The current version of the RAML specification describes the grammar of type expressions with an informal grammar and some examples. Providing a more formal EBNF grammar would add more precision and would make it easier to write a standard compliant implementation.
I already created an initial version of a type expression antlr4 grammar and you can find it here: TypeExpression.g4.
For the specification it would be nice to use the "inoffical" W3C EBNF notation and there is an online tool (http://bottlecaps.de/convert/) that can generate such a grammar from an antlr3 grammar.
When I convert my slightly modified grammar, it looks like this:
type_expr
::= qualified_name
| type_expr ( '[]' | '|' type_expr )
| '(' type_expr ')'
qualified_name
::= ID ( '.' ID )?
How is ID defined?
UPDATE
Sorry just saw your grammar where it's been defined. Still, I'd suggest to formally describe in anything that's appears inside the EBNF. What do you think?
It would be great to define the ID token in the RAML spec!
Given that all of the examples in the RAML specification use the yaml Plain Style the ID rule should follow the nb-char rule of the yaml 1.2 specification (see Line Break Characters).
But this would overlap with annotation references, which are following this rule:
annotation_ref
::= '(' ID ( ID+) ')'
Another question is: Does the RAML standard allow other yaml styles for type declaration names?