mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-19 16:21:45 +03:00
Merge pull request #1677 from AleoHQ/abnf-natural-to-numeral
Abnf natural to numeral
This commit is contained in:
commit
61c8cf8881
@ -635,56 +635,56 @@ annotation-name = "@" identifier
|
|||||||
Go to: _[identifier](#user-content-identifier)_;
|
Go to: _[identifier](#user-content-identifier)_;
|
||||||
|
|
||||||
|
|
||||||
A natural (number) is a sequence of one or more decimal digits.
|
A numeral is a sequence of one or more decimal digits.
|
||||||
We allow leading zeros, e.g. `007`.
|
We allow leading zeros, e.g. `007`.
|
||||||
|
|
||||||
<a name="natural"></a>
|
<a name="numeral"></a>
|
||||||
```abnf
|
```abnf
|
||||||
natural = 1*decimal-digit
|
numeral = 1*decimal-digit
|
||||||
```
|
```
|
||||||
|
|
||||||
Unsigned literals are naturals followed by unsigned types.
|
Unsigned literals are numerals followed by unsigned types.
|
||||||
|
|
||||||
<a name="unsigned-literal"></a>
|
<a name="unsigned-literal"></a>
|
||||||
```abnf
|
```abnf
|
||||||
unsigned-literal = natural ( %s"u8" / %s"u16" / %s"u32" / %s"u64" / %s"u128" )
|
unsigned-literal = numeral ( %s"u8" / %s"u16" / %s"u32" / %s"u64" / %s"u128" )
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to: _[natural](#user-content-natural)_;
|
Go to: _[numeral](#user-content-numeral)_;
|
||||||
|
|
||||||
|
|
||||||
Signed literals are naturals followed by signed types.
|
Signed literals are numerals followed by signed types.
|
||||||
|
|
||||||
<a name="signed-literal"></a>
|
<a name="signed-literal"></a>
|
||||||
```abnf
|
```abnf
|
||||||
signed-literal = natural ( %s"i8" / %s"i16" / %s"i32" / %s"i64" / %s"i128" )
|
signed-literal = numeral ( %s"i8" / %s"i16" / %s"i32" / %s"i64" / %s"i128" )
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to: _[natural](#user-content-natural)_;
|
Go to: _[numeral](#user-content-numeral)_;
|
||||||
|
|
||||||
|
|
||||||
Field literals are naturals followed by the type of field elements.
|
Field literals are numerals followed by the type of field elements.
|
||||||
|
|
||||||
<a name="field-literal"></a>
|
<a name="field-literal"></a>
|
||||||
```abnf
|
```abnf
|
||||||
field-literal = natural %s"field"
|
field-literal = numeral %s"field"
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to: _[natural](#user-content-natural)_;
|
Go to: _[numeral](#user-content-numeral)_;
|
||||||
|
|
||||||
|
|
||||||
There are two kinds of group literals.
|
There are two kinds of group literals.
|
||||||
One is a single natural followed by the type of group elements,
|
One is a single numeral followed by the type of group elements,
|
||||||
which denotes the scalar product of the generator point by the natural.
|
which denotes the scalar product of the generator point by the numeral.
|
||||||
The other kind is not a token because it allows some whitespace inside;
|
The other kind is not a token because it allows some whitespace inside;
|
||||||
therefore, it is defined in the syntactic grammar.
|
therefore, it is defined in the syntactic grammar.
|
||||||
|
|
||||||
<a name="product-group-literal"></a>
|
<a name="product-group-literal"></a>
|
||||||
```abnf
|
```abnf
|
||||||
product-group-literal = natural %s"group"
|
product-group-literal = numeral %s"group"
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to: _[natural](#user-content-natural)_;
|
Go to: _[numeral](#user-content-numeral)_;
|
||||||
|
|
||||||
|
|
||||||
Boolean literals are the usual two.
|
Boolean literals are the usual two.
|
||||||
@ -991,7 +991,7 @@ An array type consists of an element 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 a natural.
|
Each dimension is a numeral.
|
||||||
|
|
||||||
<a name="array-type"></a>
|
<a name="array-type"></a>
|
||||||
```abnf
|
```abnf
|
||||||
@ -1003,10 +1003,10 @@ Go to: _[array-dimensions](#user-content-array-dimensions), [type](#user-content
|
|||||||
|
|
||||||
<a name="array-dimensions"></a>
|
<a name="array-dimensions"></a>
|
||||||
```abnf
|
```abnf
|
||||||
array-dimensions = natural / "(" natural *( "," natural ) ")"
|
array-dimensions = numeral / "(" numeral *( "," numeral ) ")"
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to: _[natural](#user-content-natural)_;
|
Go to: _[numeral](#user-content-numeral)_;
|
||||||
|
|
||||||
|
|
||||||
The keyword `Self` denotes the enclosing circuit type.
|
The keyword `Self` denotes the enclosing circuit type.
|
||||||
@ -1069,10 +1069,10 @@ because it consists of affine point coordinates.
|
|||||||
|
|
||||||
<a name="group-coordinate"></a>
|
<a name="group-coordinate"></a>
|
||||||
```abnf
|
```abnf
|
||||||
group-coordinate = [ "-" ] natural / "+" / "-" / "_"
|
group-coordinate = [ "-" ] numeral / "+" / "-" / "_"
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to: _[natural](#user-content-natural)_;
|
Go to: _[numeral](#user-content-numeral)_;
|
||||||
|
|
||||||
|
|
||||||
<a name="affine-group-literal"></a>
|
<a name="affine-group-literal"></a>
|
||||||
@ -1275,7 +1275,7 @@ Go to: _[expression](#user-content-expression)_;
|
|||||||
<a name="postfix-expression"></a>
|
<a name="postfix-expression"></a>
|
||||||
```abnf
|
```abnf
|
||||||
postfix-expression = primary-expression
|
postfix-expression = primary-expression
|
||||||
/ postfix-expression "." natural
|
/ postfix-expression "." numeral
|
||||||
/ postfix-expression "." identifier
|
/ postfix-expression "." identifier
|
||||||
/ identifier function-arguments
|
/ identifier function-arguments
|
||||||
/ postfix-expression "." identifier function-arguments
|
/ postfix-expression "." identifier function-arguments
|
||||||
@ -1285,7 +1285,7 @@ postfix-expression = primary-expression
|
|||||||
/ postfix-expression "[" [expression] ".." [expression] "]"
|
/ postfix-expression "[" [expression] ".." [expression] "]"
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to: _[expression](#user-content-expression), [function-arguments](#user-content-function-arguments), [identifier](#user-content-identifier), [named-type](#user-content-named-type), [natural](#user-content-natural), [postfix-expression](#user-content-postfix-expression), [primary-expression](#user-content-primary-expression)_;
|
Go to: _[expression](#user-content-expression), [function-arguments](#user-content-function-arguments), [identifier](#user-content-identifier), [named-type](#user-content-named-type), [numeral](#user-content-numeral), [postfix-expression](#user-content-postfix-expression), [primary-expression](#user-content-primary-expression)_;
|
||||||
|
|
||||||
|
|
||||||
Unary operators have the highest operator precedence.
|
Unary operators have the highest operator precedence.
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
; usable as last resort in the definiens of a nonterminal.
|
; usable as last resort in the definiens of a nonterminal.
|
||||||
|
|
||||||
; While BNF allows arbitrary terminals,
|
; While BNF allows arbitrary terminals,
|
||||||
; ABNF uses only natural numbers as terminals,
|
; ABNF uses only natural numbers (i.e. non-negative integers) as terminals,
|
||||||
; and denotes them via:
|
; and denotes them via:
|
||||||
; (i) binary, decimal, or hexadecimal sequences,
|
; (i) binary, decimal, or hexadecimal sequences,
|
||||||
; e.g. `%b1.11.1010`, `%d1.3.10`, and `%x.1.3.A`
|
; e.g. `%b1.11.1010`, `%d1.3.10`, and `%x.1.3.A`
|
||||||
@ -451,30 +451,30 @@ identifier = letter *( letter / decimal-digit / "_" )
|
|||||||
|
|
||||||
annotation-name = "@" identifier
|
annotation-name = "@" identifier
|
||||||
|
|
||||||
; A natural (number) is a sequence of one or more decimal digits.
|
; A numeral is a sequence of one or more decimal digits.
|
||||||
; We allow leading zeros, e.g. `007`.
|
; We allow leading zeros, e.g. `007`.
|
||||||
|
|
||||||
natural = 1*decimal-digit
|
numeral = 1*decimal-digit
|
||||||
|
|
||||||
; Unsigned literals are naturals followed by unsigned types.
|
; Unsigned literals are numerals followed by unsigned types.
|
||||||
|
|
||||||
unsigned-literal = natural ( %s"u8" / %s"u16" / %s"u32" / %s"u64" / %s"u128" )
|
unsigned-literal = numeral ( %s"u8" / %s"u16" / %s"u32" / %s"u64" / %s"u128" )
|
||||||
|
|
||||||
; Signed literals are naturals followed by signed types.
|
; Signed literals are numerals followed by signed types.
|
||||||
|
|
||||||
signed-literal = natural ( %s"i8" / %s"i16" / %s"i32" / %s"i64" / %s"i128" )
|
signed-literal = numeral ( %s"i8" / %s"i16" / %s"i32" / %s"i64" / %s"i128" )
|
||||||
|
|
||||||
; Field literals are naturals followed by the type of field elements.
|
; Field literals are numerals followed by the type of field elements.
|
||||||
|
|
||||||
field-literal = natural %s"field"
|
field-literal = numeral %s"field"
|
||||||
|
|
||||||
; There are two kinds of group literals.
|
; There are two kinds of group literals.
|
||||||
; One is a single natural followed by the type of group elements,
|
; One is a single numeral followed by the type of group elements,
|
||||||
; which denotes the scalar product of the generator point by the natural.
|
; which denotes the scalar product of the generator point by the numeral.
|
||||||
; The other kind is not a token because it allows some whitespace inside;
|
; The other kind is not a token because it allows some whitespace inside;
|
||||||
; therefore, it is defined in the syntactic grammar.
|
; therefore, it is defined in the syntactic grammar.
|
||||||
|
|
||||||
product-group-literal = natural %s"group"
|
product-group-literal = numeral %s"group"
|
||||||
|
|
||||||
; Boolean literals are the usual two.
|
; Boolean literals are the usual two.
|
||||||
|
|
||||||
@ -640,11 +640,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 a natural.
|
; Each dimension is a numeral.
|
||||||
|
|
||||||
array-type = "[" type ";" array-dimensions "]"
|
array-type = "[" type ";" array-dimensions "]"
|
||||||
|
|
||||||
array-dimensions = natural / "(" natural *( "," natural ) ")"
|
array-dimensions = numeral / "(" numeral *( "," numeral ) ")"
|
||||||
|
|
||||||
; 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.
|
||||||
@ -683,7 +683,7 @@ named-type = identifier / self-type / scalar-type
|
|||||||
; This is an affine group literal,
|
; This is an affine group literal,
|
||||||
; because it consists of affine point coordinates.
|
; because it consists of affine point coordinates.
|
||||||
|
|
||||||
group-coordinate = [ "-" ] natural / "+" / "-" / "_"
|
group-coordinate = [ "-" ] numeral / "+" / "-" / "_"
|
||||||
|
|
||||||
affine-group-literal = "(" group-coordinate "," group-coordinate %s")group"
|
affine-group-literal = "(" group-coordinate "," group-coordinate %s")group"
|
||||||
|
|
||||||
@ -793,7 +793,7 @@ circuit-expression = circuit-construction
|
|||||||
function-arguments = "(" [ expression *( "," expression ) ] ")"
|
function-arguments = "(" [ expression *( "," expression ) ] ")"
|
||||||
|
|
||||||
postfix-expression = primary-expression
|
postfix-expression = primary-expression
|
||||||
/ postfix-expression "." natural
|
/ postfix-expression "." numeral
|
||||||
/ postfix-expression "." identifier
|
/ postfix-expression "." identifier
|
||||||
/ identifier function-arguments
|
/ identifier function-arguments
|
||||||
/ postfix-expression "." identifier function-arguments
|
/ postfix-expression "." identifier function-arguments
|
||||||
|
Loading…
Reference in New Issue
Block a user