Closed
Description
One example of an ambiguity in the grammar is within shape_section
given in the Smithy IDL specification under "Smithy IDL ABNF" -> "Shapes".
shape_section : [`namespace_statement` [`use_section`] [`shape_statements`]]
use_section : *(`use_statement`)
Is [`use_section`]
empty or is it populated with an empty *(`use_statement`)
?
This places Smithy IDL outside of a large class of grammars (see page 4 of Miscellaneous Parsing).
An example of where this is a problem is when trying to implement the grammar in lalrpop which will complain when we try to implement the following
use_section = use_statement*;
pub shape_section = use_section?;
A similar conflict is described in this issue.
The ambiguity around [`use_section`]
can be resolved by making it non-optional or changing use_section
to 1*(`use_statement`)
.
- Should we attempt to resolve syntax ambiguities?
- Should we document how to resolve conflicts?
- Is it permissible to change the grammar if it does not change the language/semantics?
- Should we document the formal properties of the grammar?
Disclaimer: I'm not an expert in language theory, please be skeptical of my claims and correct me where needed.
Metadata
Assignees
Labels
No labels