Merge pull request #1677 from AleoHQ/abnf-natural-to-numeral

Abnf natural to numeral
This commit is contained in:
Collin Chin 2022-03-14 14:21:00 -07:00 committed by GitHub
commit 61c8cf8881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 39 deletions

View File

@ -635,56 +635,56 @@ annotation-name = "@" 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`.
<a name="natural"></a>
<a name="numeral"></a>
```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>
```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>
```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>
```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.
One is a single natural followed by the type of group elements,
which denotes the scalar product of the generator point by the natural.
One is a single numeral followed by the type of group elements,
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;
therefore, it is defined in the syntactic grammar.
<a name="product-group-literal"></a>
```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.
@ -991,7 +991,7 @@ An array type consists of an element type
and an indication of dimensions.
There is either a single dimension,
or a tuple of one or more dimensions.
Each dimension is a natural.
Each dimension is a numeral.
<a name="array-type"></a>
```abnf
@ -1003,10 +1003,10 @@ Go to: _[array-dimensions](#user-content-array-dimensions), [type](#user-content
<a name="array-dimensions"></a>
```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.
@ -1069,10 +1069,10 @@ because it consists of affine point coordinates.
<a name="group-coordinate"></a>
```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>
@ -1275,7 +1275,7 @@ Go to: _[expression](#user-content-expression)_;
<a name="postfix-expression"></a>
```abnf
postfix-expression = primary-expression
/ postfix-expression "." natural
/ postfix-expression "." numeral
/ postfix-expression "." identifier
/ identifier function-arguments
/ postfix-expression "." identifier function-arguments
@ -1285,7 +1285,7 @@ postfix-expression = primary-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.

View File

@ -59,7 +59,7 @@
; usable as last resort in the definiens of a nonterminal.
; 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:
; (i) binary, decimal, or hexadecimal sequences,
; 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
; 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`.
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.
; One is a single natural followed by the type of group elements,
; which denotes the scalar product of the generator point by the natural.
; One is a single numeral followed by the type of group elements,
; 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;
; 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.
@ -640,11 +640,11 @@ tuple-type = "(" [ type 1*( "," type ) ] ")"
; and an indication of dimensions.
; There is either a single dimension,
; or a tuple of one or more dimensions.
; Each dimension is a natural.
; Each dimension is a numeral.
array-type = "[" type ";" array-dimensions "]"
array-dimensions = natural / "(" natural *( "," natural ) ")"
array-dimensions = numeral / "(" numeral *( "," numeral ) ")"
; The keyword `Self` denotes the enclosing circuit type.
; 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,
; because it consists of affine point coordinates.
group-coordinate = [ "-" ] natural / "+" / "-" / "_"
group-coordinate = [ "-" ] numeral / "+" / "-" / "_"
affine-group-literal = "(" group-coordinate "," group-coordinate %s")group"
@ -793,7 +793,7 @@ circuit-expression = circuit-construction
function-arguments = "(" [ expression *( "," expression ) ] ")"
postfix-expression = primary-expression
/ postfix-expression "." natural
/ postfix-expression "." numeral
/ postfix-expression "." identifier
/ identifier function-arguments
/ postfix-expression "." identifier function-arguments