From 8ba720bf43e3c6a3b4b871966a860e127888b4e7 Mon Sep 17 00:00:00 2001 From: Alessandro Coglio Date: Wed, 12 May 2021 19:15:27 -0700 Subject: [PATCH] [ABNF] Re-generate markdown file. --- grammar/README.md | 326 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 231 insertions(+), 95 deletions(-) diff --git a/grammar/README.md b/grammar/README.md index f723eecbaf..ae1e65c08e 100644 --- a/grammar/README.md +++ b/grammar/README.md @@ -354,7 +354,7 @@ Lexical Grammar A Leo file is a finite sequence of Unicode characters, represented as Unicode code points, -which are numbers in the range from 0 to 10FFFFh. +which are numbers in the range from 0 to 10FFFF. These are captured by the ABNF rule `character` below. The lexical grammar defines how, at least conceptually, @@ -416,41 +416,41 @@ space = %x20 ; double-quote = %x22 ; " ``` + +```abnf +single-quote = %x27 ; ' +``` + We give names to complements of certain ASCII characters. These consist of all the Unicode characters except for one or two. - -```abnf -not-double-quote = %x0-22 / %x24-10FFFF ; anything but " -``` - ```abnf not-star = %x0-29 / %x2B-10FFFF ; anything but * ``` + +```abnf +not-star-or-slash = %x0-29 / %x2B-2E / %x30-10FFFF + ; anything but * or / +``` + ```abnf not-line-feed-or-carriage-return = %x0-9 / %xB-C / %xE-10FFFF ; anything but or ``` - + ```abnf -not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF - ; anything but " or { +not-double-quote-or-backslash = %x0-21 / %x23-5B / %x5D-10FFFF + ; anything but " or \ ``` - + ```abnf -not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF - ; anything but " or } -``` - - -```abnf -not-star-or-slash = %x0-29 / %x2B-2E / %x30-10FFFF - ; anything but * or / +not-single-quote-or-backslash = %x0-26 / %x28-5B / %x5D-10FFFF + ; anything but ' or \ ``` Lines in Leo may be terminated via @@ -476,7 +476,7 @@ Line terminators form whitespace, along with spaces and horizontal tabs. whitespace = space / horizontal-tab / newline ``` -Go to: _[newline](#user-content-newline), [space](#user-content-space), [horizontal-tab](#user-content-horizontal-tab)_; +Go to: _[space](#user-content-space), [newline](#user-content-newline), [horizontal-tab](#user-content-horizontal-tab)_; There are two kinds of comments in Leo, as in other languages. @@ -494,7 +494,7 @@ the ones used in the Java language reference. comment = block-comment / end-of-line-comment ``` -Go to: _[end-of-line-comment](#user-content-end-of-line-comment), [block-comment](#user-content-block-comment)_; +Go to: _[block-comment](#user-content-block-comment), [end-of-line-comment](#user-content-end-of-line-comment)_; @@ -511,7 +511,7 @@ rest-of-block-comment = "*" rest-of-block-comment-after-star / not-star rest-of-block-comment ``` -Go to: _[rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [rest-of-block-comment](#user-content-rest-of-block-comment), [not-star](#user-content-not-star)_; +Go to: _[rest-of-block-comment](#user-content-rest-of-block-comment), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [not-star](#user-content-not-star)_; @@ -521,7 +521,7 @@ rest-of-block-comment-after-star = "/" / not-star-or-slash rest-of-block-comment ``` -Go to: _[not-star-or-slash](#user-content-not-star-or-slash), [rest-of-block-comment](#user-content-rest-of-block-comment), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star)_; +Go to: _[rest-of-block-comment](#user-content-rest-of-block-comment), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [not-star-or-slash](#user-content-not-star-or-slash)_; @@ -540,6 +540,7 @@ They cannot be used as identifiers. keyword = %s"address" / %s"as" / %s"bool" + / %s"char" / %s"circuit" / %s"console" / %s"const" @@ -573,8 +574,8 @@ keyword = %s"address" / %s"u128" ``` -The following rules define (ASCII) digits -and (uppercase and lowercase) letters. +The following rules define (ASCII) +digits and (uppercase and lowercase) letters. ```abnf @@ -596,7 +597,23 @@ lowercase-letter = %x61-7A ; a-z letter = uppercase-letter / lowercase-letter ``` -Go to: _[uppercase-letter](#user-content-uppercase-letter), [lowercase-letter](#user-content-lowercase-letter)_; +Go to: _[lowercase-letter](#user-content-lowercase-letter), [uppercase-letter](#user-content-uppercase-letter)_; + + +The following rules defines (ASCII) octal and hexadecimal digits. +Note that the latter are case-insensitive. + + +```abnf +octal-digit = %x30-37 ; 0-7 +``` + + +```abnf +hexadecimal-digit = digit / "a" / "b" / "c" / "d" / "e" / "f" +``` + +Go to: _[digit](#user-content-digit)_; An identifier is a non-empty sequence of letters, digits, and underscores, @@ -623,36 +640,6 @@ package-name = 1*( lowercase-letter / digit ) *( "-" 1*( lowercase-letter / digit ) ) ``` -A format string is a sequence of characters, other than double quote, -surrounded by double quotes. -Within a format string, sub-strings `{}` are distinguished as containers -(these are the ones that may be matched with values -whose textual representation replaces the containers -in the printed string). - - -```abnf -format-string-container = "{}" -``` - - -```abnf -format-string-element = not-double-quote-or-open-brace - / "{" not-double-quote-or-close-brace - / format-string-container -``` - -Go to: _[format-string-container](#user-content-format-string-container), [not-double-quote-or-close-brace](#user-content-not-double-quote-or-close-brace), [not-double-quote-or-open-brace](#user-content-not-double-quote-or-open-brace)_; - - - -```abnf -format-string = double-quote *format-string-element double-quote -``` - -Go to: _[double-quote](#user-content-double-quote)_; - - Annotations have names, which are identifiers immediately preceded by `@`. @@ -752,6 +739,128 @@ Thus an address always consists of 63 characters. address-literal = %s"aleo1" 58( lowercase-letter / digit ) ``` +A character literal consists of an element surrounded by single quotes. +The element is any character other than single quote or backslash, +or an escape, which starts with backslash. +There are simple escapes with a single character, +ASCII escapes with an octal and a hexadecimal digit +(which together denote a number between 0 and 127), +and Unicode escapes with one to six hexadecimal digits +(which must not exceed 10FFFF). + + +```abnf +character-literal = single-quote character-literal-element single-quote +``` + +Go to: _[single-quote](#user-content-single-quote), [character-literal-element](#user-content-character-literal-element)_; + + + +```abnf +character-literal-element = not-single-quote-or-backslash + / simple-character-escape + / ascii-character-escape + / unicode-character-escape +``` + +Go to: _[unicode-character-escape](#user-content-unicode-character-escape), [simple-character-escape](#user-content-simple-character-escape), [not-single-quote-or-backslash](#user-content-not-single-quote-or-backslash), [ascii-character-escape](#user-content-ascii-character-escape)_; + + + +```abnf +single-quote-escape = "\" single-quote ; \' +``` + +Go to: _[single-quote](#user-content-single-quote)_; + + + +```abnf +double-quote-escape = "\" double-quote ; \" +``` + +Go to: _[double-quote](#user-content-double-quote)_; + + + +```abnf +backslash-escape = "\\" +``` + + +```abnf +line-feed-escape = %s"\n" +``` + + +```abnf +carriage-return-escape = %s"\r" +``` + + +```abnf +horizontal-tab-escape = %s"\t" +``` + + +```abnf +null-character-escape = "\0" +``` + + +```abnf +simple-character-escape = single-quote-escape + / double-quote-escape + / backslash-escape + / line-feed-escape + / carriage-return-escape + / horizontal-tab-escape + / null-character-escape +``` + +Go to: _[null-character-escape](#user-content-null-character-escape), [carriage-return-escape](#user-content-carriage-return-escape), [horizontal-tab-escape](#user-content-horizontal-tab-escape), [single-quote-escape](#user-content-single-quote-escape), [double-quote-escape](#user-content-double-quote-escape), [backslash-escape](#user-content-backslash-escape), [line-feed-escape](#user-content-line-feed-escape)_; + + + +```abnf +ascii-character-escape = %s"\x" octal-digit hexadecimal-digit +``` + +Go to: _[octal-digit](#user-content-octal-digit), [hexadecimal-digit](#user-content-hexadecimal-digit)_; + + + +```abnf +unicode-character-escape = %s"\u{" 1*6hexadecimal-digit "}" +``` + +A string literal consists of one or more elements surrounded by double quotes. +Each element is any character other than double quote or backslash, +or an escape among the same ones used for elements of character literals. +There must be at least one element +because string literals denote character arrays, +and arrays must not be empty. + + +```abnf +string-literal = double-quote 1*string-literal-element double-quote +``` + +Go to: _[double-quote](#user-content-double-quote)_; + + + +```abnf +string-literal-element = not-double-quote-or-backslash + / simple-character-escape + / ascii-character-escape + / unicode-character-escape +``` + +Go to: _[ascii-character-escape](#user-content-ascii-character-escape), [not-double-quote-or-backslash](#user-content-not-double-quote-or-backslash), [unicode-character-escape](#user-content-unicode-character-escape), [simple-character-escape](#user-content-simple-character-escape)_; + + The ones above are all the atomic literals (in the sense that they are tokens, without whitespace allowed in them), as defined by the following rule. @@ -765,9 +874,11 @@ atomic-literal = untyped-literal / product-group-literal / boolean-literal / address-literal + / character-literal + / string-literal ``` -Go to: _[untyped-literal](#user-content-untyped-literal), [product-group-literal](#user-content-product-group-literal), [unsigned-literal](#user-content-unsigned-literal), [signed-literal](#user-content-signed-literal), [boolean-literal](#user-content-boolean-literal), [address-literal](#user-content-address-literal), [field-literal](#user-content-field-literal)_; +Go to: _[product-group-literal](#user-content-product-group-literal), [field-literal](#user-content-field-literal), [untyped-literal](#user-content-untyped-literal), [boolean-literal](#user-content-boolean-literal), [address-literal](#user-content-address-literal), [unsigned-literal](#user-content-unsigned-literal), [character-literal](#user-content-character-literal), [signed-literal](#user-content-signed-literal), [string-literal](#user-content-string-literal)_; After defining the (mostly) alphanumeric tokens above, @@ -807,12 +918,11 @@ token = keyword / identifier / atomic-literal / package-name - / format-string / annotation-name / symbol ``` -Go to: _[keyword](#user-content-keyword), [atomic-literal](#user-content-atomic-literal), [package-name](#user-content-package-name), [annotation-name](#user-content-annotation-name), [format-string](#user-content-format-string), [symbol](#user-content-symbol), [identifier](#user-content-identifier)_; +Go to: _[symbol](#user-content-symbol), [identifier](#user-content-identifier), [package-name](#user-content-package-name), [keyword](#user-content-keyword), [atomic-literal](#user-content-atomic-literal), [annotation-name](#user-content-annotation-name)_; @@ -872,7 +982,7 @@ arithmetic-type = integer-type / field-type / group-type Go to: _[integer-type](#user-content-integer-type), [group-type](#user-content-group-type), [field-type](#user-content-field-type)_; -The arithmetic types, along with the boolean and address types, +The arithmetic types, along with the boolean, address, and character types, form the scalar types, i.e. the ones whose values do not contain (sub-)values. @@ -885,12 +995,17 @@ boolean-type = %s"bool" address-type = %s"address" ``` - + ```abnf -scalar-type = boolean-type / arithmetic-type / address-type +character-type = %s"char" ``` -Go to: _[address-type](#user-content-address-type), [boolean-type](#user-content-boolean-type), [arithmetic-type](#user-content-arithmetic-type)_; + +```abnf +scalar-type = boolean-type / arithmetic-type / address-type / character-type +``` + +Go to: _[arithmetic-type](#user-content-arithmetic-type), [boolean-type](#user-content-boolean-type), [character-type](#user-content-character-type), [address-type](#user-content-address-type)_; Circuit types are denoted by identifiers and the keyword `Self`. @@ -907,7 +1022,7 @@ self-type = %s"Self" circuit-type = identifier / self-type ``` -Go to: _[identifier](#user-content-identifier), [self-type](#user-content-self-type)_; +Go to: _[self-type](#user-content-self-type), [identifier](#user-content-identifier)_; A tuple type consists of zero, two, or more component types. @@ -930,7 +1045,7 @@ or a tuple of one or more dimensions. array-type = "[" type ";" array-dimensions "]" ``` -Go to: _[type](#user-content-type), [array-dimensions](#user-content-array-dimensions)_; +Go to: _[array-dimensions](#user-content-array-dimensions), [type](#user-content-type)_; @@ -951,7 +1066,7 @@ i.e. types whose values contain (sub-)values aggregate-type = tuple-type / array-type / circuit-type ``` -Go to: _[circuit-type](#user-content-circuit-type), [tuple-type](#user-content-tuple-type), [array-type](#user-content-array-type)_; +Go to: _[array-type](#user-content-array-type), [tuple-type](#user-content-tuple-type), [circuit-type](#user-content-circuit-type)_; Scalar and aggregate types form all the types. @@ -1039,7 +1154,7 @@ primary-expression = identifier / circuit-expression ``` -Go to: _[expression](#user-content-expression), [literal](#user-content-literal), [identifier](#user-content-identifier), [array-expression](#user-content-array-expression), [circuit-expression](#user-content-circuit-expression), [tuple-expression](#user-content-tuple-expression)_; +Go to: _[literal](#user-content-literal), [identifier](#user-content-identifier), [tuple-expression](#user-content-tuple-expression), [array-expression](#user-content-array-expression), [circuit-expression](#user-content-circuit-expression), [expression](#user-content-expression)_; Tuple expressions construct tuples. @@ -1092,7 +1207,7 @@ Go to: _[expression](#user-content-expression)_; array-repeat-construction = "[" expression ";" array-dimensions "]" ``` -Go to: _[expression](#user-content-expression), [array-dimensions](#user-content-array-dimensions)_; +Go to: _[array-dimensions](#user-content-array-dimensions), [expression](#user-content-expression)_; @@ -1128,7 +1243,7 @@ circuit-construction = circuit-type "{" "}" ``` -Go to: _[circuit-type](#user-content-circuit-type), [circuit-inline-element](#user-content-circuit-inline-element)_; +Go to: _[circuit-inline-element](#user-content-circuit-inline-element), [circuit-type](#user-content-circuit-type)_; @@ -1136,7 +1251,7 @@ Go to: _[circuit-type](#user-content-circuit-type), [circuit-inline-element](#us circuit-inline-element = identifier ":" expression / identifier ``` -Go to: _[expression](#user-content-expression), [identifier](#user-content-identifier)_; +Go to: _[identifier](#user-content-identifier), [expression](#user-content-expression)_; @@ -1187,7 +1302,7 @@ postfix-expression = primary-expression / postfix-expression "[" [expression] ".." [expression] "]" ``` -Go to: _[expression](#user-content-expression), [natural](#user-content-natural), [identifier](#user-content-identifier), [primary-expression](#user-content-primary-expression), [circuit-type](#user-content-circuit-type), [function-arguments](#user-content-function-arguments), [postfix-expression](#user-content-postfix-expression)_; +Go to: _[postfix-expression](#user-content-postfix-expression), [expression](#user-content-expression), [identifier](#user-content-identifier), [primary-expression](#user-content-primary-expression), [function-arguments](#user-content-function-arguments), [circuit-type](#user-content-circuit-type), [natural](#user-content-natural)_; Unary operators have the highest operator precedence. @@ -1201,7 +1316,7 @@ unary-expression = postfix-expression / "-" unary-expression ``` -Go to: _[unary-expression](#user-content-unary-expression), [postfix-expression](#user-content-postfix-expression)_; +Go to: _[postfix-expression](#user-content-postfix-expression), [unary-expression](#user-content-unary-expression)_; Next in the operator precedence is exponentiation, @@ -1215,7 +1330,7 @@ exponential-expression = unary-expression / unary-expression "**" exponential-expression ``` -Go to: _[exponential-expression](#user-content-exponential-expression), [unary-expression](#user-content-unary-expression)_; +Go to: _[unary-expression](#user-content-unary-expression), [exponential-expression](#user-content-exponential-expression)_; Next in precedence come multiplication and division, both left-associative. @@ -1227,7 +1342,7 @@ multiplicative-expression = exponential-expression / multiplicative-expression "/" exponential-expression ``` -Go to: _[multiplicative-expression](#user-content-multiplicative-expression), [exponential-expression](#user-content-exponential-expression)_; +Go to: _[exponential-expression](#user-content-exponential-expression), [multiplicative-expression](#user-content-multiplicative-expression)_; Then there are addition and subtraction, both left-assocative. @@ -1267,7 +1382,7 @@ equality-expression = ordering-expression / equality-expression "!=" ordering-expression ``` -Go to: _[ordering-expression](#user-content-ordering-expression), [equality-expression](#user-content-equality-expression)_; +Go to: _[equality-expression](#user-content-equality-expression), [ordering-expression](#user-content-ordering-expression)_; Next come conjunctive expressions, left-associative. @@ -1278,7 +1393,7 @@ conjunctive-expression = equality-expression / conjunctive-expression "&&" equality-expression ``` -Go to: _[equality-expression](#user-content-equality-expression), [conjunctive-expression](#user-content-conjunctive-expression)_; +Go to: _[conjunctive-expression](#user-content-conjunctive-expression), [equality-expression](#user-content-equality-expression)_; Next come disjunctive expressions, left-associative. @@ -1289,7 +1404,7 @@ disjunctive-expression = conjunctive-expression / disjunctive-expression "||" conjunctive-expression ``` -Go to: _[conjunctive-expression](#user-content-conjunctive-expression), [disjunctive-expression](#user-content-disjunctive-expression)_; +Go to: _[disjunctive-expression](#user-content-disjunctive-expression), [conjunctive-expression](#user-content-conjunctive-expression)_; Finally we have conditional expressions. @@ -1302,7 +1417,7 @@ conditional-expression = disjunctive-expression ":" conditional-expression ``` -Go to: _[expression](#user-content-expression), [disjunctive-expression](#user-content-disjunctive-expression), [conditional-expression](#user-content-conditional-expression)_; +Go to: _[disjunctive-expression](#user-content-disjunctive-expression), [conditional-expression](#user-content-conditional-expression), [expression](#user-content-expression)_; Those above are all the expressions. @@ -1335,7 +1450,7 @@ statement = expression-statement / block ``` -Go to: _[block](#user-content-block), [constant-declaration](#user-content-constant-declaration), [variable-declaration](#user-content-variable-declaration), [return-statement](#user-content-return-statement), [expression-statement](#user-content-expression-statement), [loop-statement](#user-content-loop-statement), [conditional-statement](#user-content-conditional-statement), [assignment-statement](#user-content-assignment-statement), [console-statement](#user-content-console-statement)_; +Go to: _[constant-declaration](#user-content-constant-declaration), [variable-declaration](#user-content-variable-declaration), [conditional-statement](#user-content-conditional-statement), [loop-statement](#user-content-loop-statement), [block](#user-content-block), [assignment-statement](#user-content-assignment-statement), [console-statement](#user-content-console-statement), [expression-statement](#user-content-expression-statement), [return-statement](#user-content-return-statement)_; @@ -1378,7 +1493,7 @@ variable-declaration = %s"let" identifier-or-identifiers [ ":" type ] "=" expression ";" ``` -Go to: _[type](#user-content-type), [expression](#user-content-expression), [identifier-or-identifiers](#user-content-identifier-or-identifiers)_; +Go to: _[identifier-or-identifiers](#user-content-identifier-or-identifiers), [type](#user-content-type), [expression](#user-content-expression)_; @@ -1387,7 +1502,7 @@ constant-declaration = %s"const" identifier-or-identifiers [ ":" type ] "=" expression ";" ``` -Go to: _[identifier-or-identifiers](#user-content-identifier-or-identifiers), [type](#user-content-type), [expression](#user-content-expression)_; +Go to: _[identifier-or-identifiers](#user-content-identifier-or-identifiers), [expression](#user-content-expression), [type](#user-content-type)_; @@ -1410,7 +1525,7 @@ Note that blocks are required in all branches, not merely statements. branch = %s"if" expression block ``` -Go to: _[block](#user-content-block), [expression](#user-content-expression)_; +Go to: _[expression](#user-content-expression), [block](#user-content-block)_; @@ -1420,7 +1535,7 @@ conditional-statement = branch / branch %s"else" conditional-statement ``` -Go to: _[branch](#user-content-branch), [block](#user-content-block), [conditional-statement](#user-content-conditional-statement)_; +Go to: _[conditional-statement](#user-content-conditional-statement), [branch](#user-content-branch), [block](#user-content-block)_; A loop statement implicitly defines a loop variable @@ -1449,7 +1564,7 @@ assignment-operator = "=" / "+=" / "-=" / "*=" / "/=" / "**=" assignment-statement = expression assignment-operator expression ";" ``` -Go to: _[expression](#user-content-expression), [assignment-operator](#user-content-assignment-operator)_; +Go to: _[assignment-operator](#user-content-assignment-operator), [expression](#user-content-expression)_; Console statements start with the `console` keyword, @@ -1494,10 +1609,10 @@ print-function = %s"debug" / %s"error" / %s"log" ```abnf -print-arguments = "(" [ format-string *( "," expression ) ] ")" +print-arguments = "(" [ string-literal *( "," expression ) ] ")" ``` -Go to: _[format-string](#user-content-format-string)_; +Go to: _[string-literal](#user-content-string-literal)_; @@ -1518,7 +1633,7 @@ annotation = annotation-name [ "(" identifier *( "," identifier ) ")" ] ``` -Go to: _[annotation-name](#user-content-annotation-name), [identifier](#user-content-identifier)_; +Go to: _[identifier](#user-content-identifier), [annotation-name](#user-content-annotation-name)_; A function declaration defines a function. @@ -1535,7 +1650,7 @@ function-declaration = *annotation %s"function" identifier block ``` -Go to: _[type](#user-content-type), [block](#user-content-block), [identifier](#user-content-identifier), [function-parameters](#user-content-function-parameters)_; +Go to: _[function-parameters](#user-content-function-parameters), [type](#user-content-type), [block](#user-content-block), [identifier](#user-content-identifier)_; @@ -1545,7 +1660,7 @@ function-parameters = self-parameter / function-inputs ``` -Go to: _[function-inputs](#user-content-function-inputs), [self-parameter](#user-content-self-parameter)_; +Go to: _[self-parameter](#user-content-self-parameter), [function-inputs](#user-content-function-inputs)_; @@ -1569,17 +1684,28 @@ function-input = [ %s"const" ] identifier ":" type Go to: _[identifier](#user-content-identifier), [type](#user-content-type)_; -A circuit member variable declaration consists of an identifier and a type. -A circuit member function declaration consists of a function declaration. +A circuit member variable declaration consists of +an identifier and a type, terminated by semicolon. +For backward compatibility, +member variable declarations may be alternatively followed by commas, +and the last one may not be followed by anything: +these are deprecated, and will be eventually removed, +leaving only mandatory semicolons. +Note that there is no rule for a single `member-variable-declaration`, +but instead one for a sequence of them; +see the rule `circuit-declaration`. ```abnf -member-variable-declarations = *(identifier ":" type ( "," / ";" )) identifier ":" type ( [ "," ] / ";" ) +member-variable-declarations = *( identifier ":" type ( "," / ";" ) ) + identifier ":" type ( [ "," ] / ";" ) ``` Go to: _[identifier](#user-content-identifier), [type](#user-content-type)_; +A circuit member function declaration consists of a function declaration. + ```abnf member-function-declaration = function-declaration @@ -1590,14 +1716,20 @@ Go to: _[function-declaration](#user-content-function-declaration)_; A circuit declaration defines a circuit type, as consisting of member variables and functions. +To more simply accommodate the backward compatibility +described for the rule `member-variable-declarations`, +all the member variables must precede all the member functions; +this may be relaxed after the backward compatibility is removed, +allowing member variables and member functions to be intermixed. ```abnf circuit-declaration = *annotation %s"circuit" identifier - "{" [ member-variable-declarations ] *member-function-declaration "}" + "{" [ member-variable-declarations ] + *member-function-declaration "}" ``` -Go to: _[member-variable-declarations](#user-content-member-variable-declarations), [identifier](#user-content-identifier)_; +Go to: _[identifier](#user-content-identifier), [member-variable-declarations](#user-content-member-variable-declarations)_; An import declaration consists of the `import` keyword @@ -1609,6 +1741,10 @@ or a parenthesized list of package paths, which are "fan out" of the initial path. Note that we allow the last element of the parenthesized list to be followed by a comma, for convenience. +The package path in the import declaration must start with a package name +(e.g. it cannot be a `*`): +the rule for import declaration expresses this requirement +by using an explicit package name before the package path. ```abnf @@ -1626,7 +1762,7 @@ package-path = "*" / "(" package-path *( "," package-path ) [","] ")" ``` -Go to: _[package-name](#user-content-package-name), [identifier](#user-content-identifier), [package-path](#user-content-package-path)_; +Go to: _[identifier](#user-content-identifier), [package-path](#user-content-package-path), [package-name](#user-content-package-name)_; Finally, we define a file as a sequence of zero or more declarations. @@ -1641,7 +1777,7 @@ declaration = import-declaration / constant-declaration ``` -Go to: _[function-declaration](#user-content-function-declaration), [circuit-declaration](#user-content-circuit-declaration), [import-declaration](#user-content-import-declaration), [constant-declaration](#user-content-constant-declaration)_; +Go to: _[circuit-declaration](#user-content-circuit-declaration), [constant-declaration](#user-content-constant-declaration), [function-declaration](#user-content-function-declaration), [import-declaration](#user-content-import-declaration)_;