[ABNF] Adapt ABNF to removal of unsized arrays.

This "merges" the two previous slightly different notions of array type
dimensions and array expression dimension(s) into one notion of array
dimensions, in which the dimensions have to be natural numbers. (Previously,
array type dimensions were allowed to be unspecified (via underscores), while
array expression dimensions had to be specified.)
This commit is contained in:
Alessandro Coglio 2022-03-04 19:42:42 -08:00
parent 1a45295372
commit c30df925ef

View File

@ -650,15 +650,11 @@ tuple-type = "(" [ type 1*( "," type ) ] ")"
; and an indication of dimensions. ; and an indication of dimensions.
; There is either a single dimension, ; There is either a single dimension,
; or a tuple of one or more dimensions. ; or a tuple of one or more dimensions.
; Each dimension is natural. ; Each dimension is a natural.
array-type = "[" type ";" array-type-dimensions "]" array-type = "[" type ";" array-dimensions "]"
array-type-dimension = natural / "_" array-dimensions = natural / "(" natural *( "," natural ) ")"
array-type-dimensions = array-type-dimension
/ "(" array-type-dimension
*( "," array-type-dimension ) [","] ")"
; The keyword `Self` denotes the enclosing circuit type. ; The keyword `Self` denotes the enclosing circuit type.
; It is only allowed inside a circuit type declaration. ; It is only allowed inside a circuit type declaration.
@ -756,10 +752,7 @@ array-inline-construction = "["
array-inline-element = expression / "..." expression array-inline-element = expression / "..." expression
array-repeat-construction = "[" expression ";" array-expression-dimensions "]" array-repeat-construction = "[" expression ";" array-dimensions "]"
array-expression-dimensions = natural
/ "(" natural *( "," natural ) ")"
array-construction = array-inline-construction / array-repeat-construction array-construction = array-inline-construction / array-repeat-construction