Commit Graph

18 Commits

Author SHA1 Message Date
Alessandro Coglio
729dbaceec [ABNF] Allow trailing commas everywhere.
Also disallow 1-tuple array dimensions.
2022-03-16 20:40:06 -07:00
Collin Chin
07d03b0ff1
Merge pull request #1684 from AleoHQ/abnf-numeral-is-token
[ABNF] Add numerals to tokens.
2022-03-15 14:50:56 -07:00
Collin Chin
f886890e2b
Merge pull request #1679 from AleoHQ/abnf-doc-fix-b
[ABNF] Update some documentation
2022-03-15 10:22:54 -07:00
Alessandro Coglio
efffcc98dc [ABNF] Add numerals to tokens.
Given that arithmetic literals are now all typed in the grammar, we need
numerals to be listed as tokens. Otherwise, array dimensions and tuple indices
would not be tokens, but they must be.
2022-03-14 22:05:42 -07:00
Eric McCarthy
572d59d67f [ABNF] regenerate README.md 2022-03-14 12:35:56 -07:00
Eric McCarthy
ffa8200d92 [ABNF] update some documentation 2022-03-14 12:29:19 -07:00
Alessandro Coglio
3f6b17646c [ABNF] Add a clarification to the documentation.
No grammar change in this commit.
2022-03-10 15:31:31 -08:00
Alessandro Coglio
ca3ae89a3e [ABNF] Rename 'natural' to 'numeral'.
This applies both to the rule name and to the terminology used for that, namely
for a non-empty sequence of decimal digits.

While 'natural' was meant to describe a natural number (i.e. a non-negative
integer: 0, 1, 2, ...), it is perhaps not a familiar term to many users.

On the other hand, 'integer', while often used in programming languages for this
kind of thing, is not ideal as integers may be negative.

Also, assuming type inference, a lone numeral like `17` may actually not denote
an integer number at all, because it may actually denote a group element if type
inference turns it into `17group`, and group elements are not integers.

All in all, 'numeral' seems like a good term, also according to its dictionary
definition. It is used in the Java grammar to denote this kind of thing, for
instance.

If, in the future, we want to allow hexadecimal, octal, or binary notation, we
could rename this to `decimal-numeral`, introduce `hexadecimal-numeral`,
`octal-numeral`, and `binary-numeral`, and `numeral` as the union of these.
2022-03-10 15:23:58 -08:00
Collin Chin
4dd70474f5
Merge pull request #1669 from AleoHQ/abnf-integer-fix
[ABNF] Fix use of integers in literals.
2022-03-10 12:02:10 -08:00
Alessandro Coglio
f735ca8864 [ABNF] Update some documentation.
This does not change the grammar. It merely updates some text in the comments,
which shows a rule that was changed at some point but its copy in the comments
was not properly updated.

Thanks to @bendyarm for noticing this.
2022-03-08 23:23:38 -08:00
Alessandro Coglio
7e930d8670 [ABNF] Fix use of integers in literals.
This removes the rule for `integer` and uses `natural` for all numeric literals.

Otherwise, lexing would be context-dependent for no good reason.

This is consistent with the lexer and parser of the Leo compiler.

Note that, for instance, `-1field` is not a literal, but rather a unary
expression where `-` is applied to the literal `1field`. This is consistent with
other languages too.
2022-03-08 21:08:59 -08:00
Collin Chin
5e2ba78750
Merge pull request #1656 from AleoHQ/remove/unsized-array
Remove/unsized array
2022-03-07 17:14:03 -08:00
Alessandro Coglio
6cbf206f86 [ABNF] Require types to avoid type inference.
Types are now required in variable and constant declarations (including for loop
variables), and for literals (i.e. there are no longer untyped literals).
2022-03-05 23:52:34 -08:00
Alessandro Coglio
6aca970b88 [ABNF] Re-generate markdown.
(Forgot to do this in the previous commit.)
2022-03-04 19:51:14 -08:00
Alessandro Coglio
c30df925ef [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.)
2022-03-04 19:42:42 -08:00
collin
10bea676a8 remove unsized arrays 2022-03-04 12:23:46 -08:00
collin
22f605349c merge testnet3 2022-02-28 09:42:37 -08:00
collin
e263e64279 restructure compiler and delete unused code 2022-02-22 15:12:52 -08:00