From e82be01d7570878f13cc43688164307a50def322 Mon Sep 17 00:00:00 2001 From: gluax Date: Mon, 26 Apr 2021 17:53:39 -0400 Subject: [PATCH] regen grammar README.md --- grammar/README.md | 110 ++++++++++++---------------------------------- 1 file changed, 29 insertions(+), 81 deletions(-) diff --git a/grammar/README.md b/grammar/README.md index af3a7f3680..5d75f04bce 100644 --- a/grammar/README.md +++ b/grammar/README.md @@ -466,7 +466,7 @@ described above. newline = line-feed / carriage-return / carriage-return line-feed ``` -Go to: _[carriage-return](#user-content-carriage-return), [line-feed](#user-content-line-feed)_; +Go to: _[line-feed](#user-content-line-feed), [carriage-return](#user-content-carriage-return)_; Line terminators form whitespace, along with spaces and horizontal tabs. @@ -476,11 +476,7 @@ Line terminators form whitespace, along with spaces and horizontal tabs. whitespace = space / horizontal-tab / newline ``` -<<<<<<< HEAD:grammar/abnf-grammar.md -Go to: _[space](#user-content-space), [horizontal-tab](#user-content-horizontal-tab), [newline](#user-content-newline)_; -======= -Go to: _[horizontal-tab](#user-content-horizontal-tab), [space](#user-content-space), [newline](#user-content-newline)_; ->>>>>>> 35619c99b49b7faa33b41466766d329a9130d25f:grammar/README.md +Go to: _[newline](#user-content-newline), [space](#user-content-space), [horizontal-tab](#user-content-horizontal-tab)_; There are two kinds of comments in Leo, as in other languages. @@ -515,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), [not-star](#user-content-not-star), [rest-of-block-comment](#user-content-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)_; @@ -525,7 +521,7 @@ rest-of-block-comment-after-star = "/" / not-star-or-slash rest-of-block-comment ``` -Go to: _[rest-of-block-comment](#user-content-rest-of-block-comment), [not-star-or-slash](#user-content-not-star-or-slash), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star)_; +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-or-slash](#user-content-not-star-or-slash)_; @@ -643,7 +639,7 @@ format-string-element = not-double-quote-or-open-brace / format-string-container ``` -Go to: _[not-double-quote-or-close-brace](#user-content-not-double-quote-or-close-brace), [format-string-container](#user-content-format-string-container), [not-double-quote-or-open-brace](#user-content-not-double-quote-or-open-brace)_; +Go to: _[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), [format-string-container](#user-content-format-string-container)_; @@ -768,11 +764,7 @@ atomic-literal = untyped-literal / address-literal ``` -<<<<<<< HEAD:grammar/abnf-grammar.md -Go to: _[group-literal](#user-content-group-literal), [untyped-literal](#user-content-untyped-literal), [unsigned-literal](#user-content-unsigned-literal), [signed-literal](#user-content-signed-literal), [field-literal](#user-content-field-literal), [boolean-literal](#user-content-boolean-literal), [address-literal](#user-content-address-literal)_; -======= -Go to: _[signed-literal](#user-content-signed-literal), [field-literal](#user-content-field-literal), [product-group-literal](#user-content-product-group-literal), [unsigned-literal](#user-content-unsigned-literal), [untyped-literal](#user-content-untyped-literal), [boolean-literal](#user-content-boolean-literal), [address-literal](#user-content-address-literal)_; ->>>>>>> 35619c99b49b7faa33b41466766d329a9130d25f:grammar/README.md +Go to: _[unsigned-literal](#user-content-unsigned-literal), [signed-literal](#user-content-signed-literal), [product-group-literal](#user-content-product-group-literal), [address-literal](#user-content-address-literal), [boolean-literal](#user-content-boolean-literal), [field-literal](#user-content-field-literal), [untyped-literal](#user-content-untyped-literal)_; After defining the (mostly) alphanumeric tokens above, @@ -845,11 +837,7 @@ token = keyword / symbol ``` -<<<<<<< HEAD:grammar/abnf-grammar.md -Go to: _[literal](#user-content-literal), [annotation-name](#user-content-annotation-name), [identifier](#user-content-identifier), [symbol](#user-content-symbol), [formatted-string](#user-content-formatted-string), [package-name](#user-content-package-name), [keyword](#user-content-keyword)_; -======= -Go to: _[package-name](#user-content-package-name), [format-string](#user-content-format-string), [symbol](#user-content-symbol), [identifier](#user-content-identifier), [atomic-literal](#user-content-atomic-literal), [annotation-name](#user-content-annotation-name), [keyword](#user-content-keyword)_; ->>>>>>> 35619c99b49b7faa33b41466766d329a9130d25f:grammar/README.md +Go to: _[format-string](#user-content-format-string), [annotation-name](#user-content-annotation-name), [package-name](#user-content-package-name), [keyword](#user-content-keyword), [symbol](#user-content-symbol), [identifier](#user-content-identifier), [atomic-literal](#user-content-atomic-literal)_; @@ -885,7 +873,7 @@ signed-type = %s"i8" / %s"i16" / %s"i32" / %s"i64" / %s"i128" integer-type = unsigned-type / signed-type ``` -Go to: _[signed-type](#user-content-signed-type), [unsigned-type](#user-content-unsigned-type)_; +Go to: _[unsigned-type](#user-content-unsigned-type), [signed-type](#user-content-signed-type)_; The integer types, along with the field and group types, @@ -906,7 +894,7 @@ group-type = %s"group" arithmetic-type = integer-type / field-type / group-type ``` -Go to: _[group-type](#user-content-group-type), [field-type](#user-content-field-type), [integer-type](#user-content-integer-type)_; +Go to: _[field-type](#user-content-field-type), [group-type](#user-content-group-type), [integer-type](#user-content-integer-type)_; The arithmetic types, along with the boolean and address types, @@ -927,7 +915,7 @@ address-type = %s"address" scalar-type = boolean-type / arithmetic-type / address-type ``` -Go to: _[address-type](#user-content-address-type), [arithmetic-type](#user-content-arithmetic-type), [boolean-type](#user-content-boolean-type)_; +Go to: _[boolean-type](#user-content-boolean-type), [arithmetic-type](#user-content-arithmetic-type), [address-type](#user-content-address-type)_; Circuit types are denoted by identifiers and the keyword `Self`. @@ -998,7 +986,7 @@ Scalar and aggregate types form all the types. type = scalar-type / aggregate-type ``` -Go to: _[aggregate-type](#user-content-aggregate-type), [scalar-type](#user-content-scalar-type)_; +Go to: _[scalar-type](#user-content-scalar-type), [aggregate-type](#user-content-aggregate-type)_; The lexical grammar given earlier defines product group literals. @@ -1047,7 +1035,7 @@ a group literal is either a product group literal or an affine group literal. group-literal = product-group-literal / affine-group-literal ``` -Go to: _[product-group-literal](#user-content-product-group-literal), [affine-group-literal](#user-content-affine-group-literal)_; +Go to: _[affine-group-literal](#user-content-affine-group-literal), [product-group-literal](#user-content-product-group-literal)_; As often done in grammatical language syntax specifications, @@ -1076,11 +1064,7 @@ primary-expression = identifier / circuit-expression ``` -<<<<<<< HEAD:grammar/abnf-grammar.md -Go to: _[literal](#user-content-literal), [identifier](#user-content-identifier), [expression](#user-content-expression), [function-call](#user-content-function-call), [array-expression](#user-content-array-expression), [circuit-expression](#user-content-circuit-expression), [tuple-expression](#user-content-tuple-expression)_; -======= -Go to: _[array-expression](#user-content-array-expression), [identifier](#user-content-identifier), [expression](#user-content-expression), [literal](#user-content-literal), [tuple-expression](#user-content-tuple-expression), [circuit-expression](#user-content-circuit-expression)_; ->>>>>>> 35619c99b49b7faa33b41466766d329a9130d25f:grammar/README.md +Go to: _[identifier](#user-content-identifier), [array-expression](#user-content-array-expression), [expression](#user-content-expression), [tuple-expression](#user-content-tuple-expression), [circuit-expression](#user-content-circuit-expression), [literal](#user-content-literal)_; Tuple expressions construct tuples. @@ -1133,7 +1117,7 @@ Go to: _[expression](#user-content-expression)_; array-repeat-construction = "[" expression ";" array-dimensions "]" ``` -Go to: _[array-dimensions](#user-content-array-dimensions), [expression](#user-content-expression)_; +Go to: _[expression](#user-content-expression), [array-dimensions](#user-content-array-dimensions)_; @@ -1177,7 +1161,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)_; @@ -1228,7 +1212,7 @@ postfix-expression = primary-expression / postfix-expression "[" [expression] ".." [expression] "]" ``` -Go to: _[identifier](#user-content-identifier), [function-arguments](#user-content-function-arguments), [natural](#user-content-natural), [circuit-type](#user-content-circuit-type), [primary-expression](#user-content-primary-expression), [postfix-expression](#user-content-postfix-expression), [expression](#user-content-expression)_; +Go to: _[natural](#user-content-natural), [postfix-expression](#user-content-postfix-expression), [primary-expression](#user-content-primary-expression), [circuit-type](#user-content-circuit-type), [identifier](#user-content-identifier), [expression](#user-content-expression), [function-arguments](#user-content-function-arguments)_; Unary operators have the highest operator precedence. @@ -1242,7 +1226,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, @@ -1256,11 +1240,7 @@ exponential-expression = unary-expression / unary-expression "**" exponential-expression ``` -<<<<<<< HEAD:grammar/abnf-grammar.md -Go to: _[exponential-expression](#user-content-exponential-expression), [cast-expression](#user-content-cast-expression)_; -======= Go to: _[unary-expression](#user-content-unary-expression), [exponential-expression](#user-content-exponential-expression)_; ->>>>>>> 35619c99b49b7faa33b41466766d329a9130d25f:grammar/README.md Next in precedence come multiplication and division, both left-associative. @@ -1272,7 +1252,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. @@ -1284,7 +1264,7 @@ additive-expression = multiplicative-expression / additive-expression "-" multiplicative-expression ``` -Go to: _[multiplicative-expression](#user-content-multiplicative-expression), [additive-expression](#user-content-additive-expression)_; +Go to: _[additive-expression](#user-content-additive-expression), [multiplicative-expression](#user-content-multiplicative-expression)_; Next in the precedence order are ordering relations. @@ -1347,11 +1327,7 @@ conditional-expression = disjunctive-expression ":" conditional-expression ``` -<<<<<<< HEAD:grammar/abnf-grammar.md -Go to: _[conditional-expression](#user-content-conditional-expression), [disjunctive-expression](#user-content-disjunctive-expression), [expression](#user-content-expression)_; -======= Go to: _[disjunctive-expression](#user-content-disjunctive-expression), [conditional-expression](#user-content-conditional-expression), [expression](#user-content-expression)_; ->>>>>>> 35619c99b49b7faa33b41466766d329a9130d25f:grammar/README.md Those above are all the expressions. @@ -1383,11 +1359,7 @@ statement = expression-statement / block ``` -<<<<<<< HEAD:grammar/abnf-grammar.md -Go to: _[block](#user-content-block), [assignment-statement](#user-content-assignment-statement), [return-statement](#user-content-return-statement), [conditional-statement](#user-content-conditional-statement), [loop-statement](#user-content-loop-statement), [console-statement](#user-content-console-statement), [expression-statement](#user-content-expression-statement), [variable-definition-statement](#user-content-variable-definition-statement)_; -======= -Go to: _[return-statement](#user-content-return-statement), [loop-statement](#user-content-loop-statement), [assignment-statement](#user-content-assignment-statement), [expression-statement](#user-content-expression-statement), [console-statement](#user-content-console-statement), [block](#user-content-block), [conditional-statement](#user-content-conditional-statement), [variable-definition-statement](#user-content-variable-definition-statement)_; ->>>>>>> 35619c99b49b7faa33b41466766d329a9130d25f:grammar/README.md +Go to: _[block](#user-content-block), [expression-statement](#user-content-expression-statement), [console-statement](#user-content-console-statement), [return-statement](#user-content-return-statement), [assignment-statement](#user-content-assignment-statement), [loop-statement](#user-content-loop-statement), [variable-definition-statement](#user-content-variable-definition-statement), [conditional-statement](#user-content-conditional-statement)_; @@ -1429,11 +1401,7 @@ variable-definition-statement = ( %s"let" / %s"const" ) [ ":" type ] "=" expression ";" ``` -<<<<<<< HEAD:grammar/abnf-grammar.md Go to: _[identifier-or-identifiers](#user-content-identifier-or-identifiers), [expression](#user-content-expression), [type](#user-content-type)_; -======= -Go to: _[type](#user-content-type), [identifier-or-identifiers](#user-content-identifier-or-identifiers), [expression](#user-content-expression)_; ->>>>>>> 35619c99b49b7faa33b41466766d329a9130d25f:grammar/README.md @@ -1466,11 +1434,7 @@ conditional-statement = branch / branch %s"else" conditional-statement ``` -<<<<<<< HEAD:grammar/abnf-grammar.md -Go to: _[conditional-statement](#user-content-conditional-statement), [branch](#user-content-branch), [block](#user-content-block)_; -======= -Go to: _[block](#user-content-block), [conditional-statement](#user-content-conditional-statement), [branch](#user-content-branch)_; ->>>>>>> 35619c99b49b7faa33b41466766d329a9130d25f:grammar/README.md +Go to: _[branch](#user-content-branch), [conditional-statement](#user-content-conditional-statement), [block](#user-content-block)_; A loop statement implicitly defines a loop variable @@ -1482,7 +1446,7 @@ The body is a block. loop-statement = %s"for" identifier %s"in" expression ".." expression block ``` -Go to: _[block](#user-content-block), [expression](#user-content-expression), [identifier](#user-content-identifier)_; +Go to: _[identifier](#user-content-identifier), [expression](#user-content-expression), [block](#user-content-block)_; An assignment statement is straightforward. @@ -1555,7 +1519,7 @@ Go to: _[format-string](#user-content-format-string)_; print-call = print-function print-arguments ``` -Go to: _[print-arguments](#user-content-print-arguments), [print-function](#user-content-print-function)_; +Go to: _[print-function](#user-content-print-function), [print-arguments](#user-content-print-arguments)_; An annotation consists of an annotation name (which starts with `@`) @@ -1585,11 +1549,7 @@ function-declaration = *annotation %s"function" identifier block ``` -<<<<<<< HEAD:grammar/abnf-grammar.md -Go to: _[identifier](#user-content-identifier), [type](#user-content-type), [block](#user-content-block), [function-parameters](#user-content-function-parameters)_; -======= -Go to: _[type](#user-content-type), [block](#user-content-block), [identifier](#user-content-identifier), [function-parameters](#user-content-function-parameters)_; ->>>>>>> 35619c99b49b7faa33b41466766d329a9130d25f:grammar/README.md +Go to: _[function-parameters](#user-content-function-parameters), [identifier](#user-content-identifier), [block](#user-content-block), [type](#user-content-type)_; @@ -1599,11 +1559,7 @@ function-parameters = self-parameter / function-inputs ``` -<<<<<<< HEAD:grammar/abnf-grammar.md -Go to: _[function-inputs](#user-content-function-inputs), [input-parameter](#user-content-input-parameter), [self-parameter](#user-content-self-parameter)_; -======= Go to: _[function-inputs](#user-content-function-inputs), [self-parameter](#user-content-self-parameter)_; ->>>>>>> 35619c99b49b7faa33b41466766d329a9130d25f:grammar/README.md @@ -1664,7 +1620,7 @@ circuit-declaration = *annotation %s"circuit" identifier "{" member-declaration *( "," member-declaration ) "}" ``` -Go to: _[identifier](#user-content-identifier), [member-declaration](#user-content-member-declaration)_; +Go to: _[member-declaration](#user-content-member-declaration), [identifier](#user-content-identifier)_; An import declaration consists of the `import` keyword @@ -1693,8 +1649,7 @@ package-path = "*" / "(" package-path *( "," package-path ) [","] ")" ``` -<<<<<<< HEAD:grammar/abnf-grammar.md -Go to: _[package-path](#user-content-package-path), [package-name](#user-content-package-name), [identifier](#user-content-identifier)_; +Go to: _[package-path](#user-content-package-path), [identifier](#user-content-identifier), [package-name](#user-content-package-name)_; A global const declaration consists of the 'const' keyword @@ -1704,13 +1659,10 @@ expression and finally a terminator ';' symbol. ```abnf -global-constant-declaration = "const" identifier [ ":" type ] "=" expression ";" +global-constant-declaration = %s"const" identifier [ ":" type ] "=" expression ";" ``` -Go to: _[type](#user-content-type), [identifier](#user-content-identifier), [expression](#user-content-expression)_; -======= -Go to: _[package-name](#user-content-package-name), [package-path](#user-content-package-path), [identifier](#user-content-identifier)_; ->>>>>>> 35619c99b49b7faa33b41466766d329a9130d25f:grammar/README.md +Go to: _[expression](#user-content-expression), [identifier](#user-content-identifier), [type](#user-content-type)_; Finally, we define a file as a sequence of zero or more declarations. @@ -1723,11 +1675,7 @@ declaration = import-declaration / global-constant-declaration ``` -<<<<<<< HEAD:grammar/abnf-grammar.md -Go to: _[circuit-declaration](#user-content-circuit-declaration), [function-declaration](#user-content-function-declaration), [global-constant-declaration](#user-content-global-constant-declaration), [import-declaration](#user-content-import-declaration)_; -======= -Go to: _[function-declaration](#user-content-function-declaration), [circuit-declaration](#user-content-circuit-declaration), [import-declaration](#user-content-import-declaration)_; ->>>>>>> 35619c99b49b7faa33b41466766d329a9130d25f:grammar/README.md +Go to: _[import-declaration](#user-content-import-declaration), [function-declaration](#user-content-function-declaration), [global-constant-declaration](#user-content-global-constant-declaration), [circuit-declaration](#user-content-circuit-declaration)_;