Commit Graph

226 Commits

Author SHA1 Message Date
gluax
2a7298b873
Merge pull request #1406 from AleoHQ/abnf-empty-circuit
[ABNF] Fix rule for circuit inline expressions.
2021-10-20 04:25:14 -07:00
Alessandro Coglio
1aa9e4c852 [ABNF] Fix rule for console statements.
The ending semicolon was missing.

This was found by @bendyarm, while investigating a discrepancy between the Leo
parser in Rust and the Leo parser in ACL2: the latter was correctly following
the erroneous grammar rule; it will be changed to be consistent with the fixed
rule.
2021-10-19 18:01:48 -07:00
Alessandro Coglio
40c5d0f868 [ABNF] Re-generate markdown. 2021-10-19 17:52:45 -07:00
Alessandro Coglio
a52ee75191 [ABNF] Fix rule for circuit inline expressions.
The rule failed to disallow expressions like circuit C {}, i.e. with no member
variables. This has been fixed by making the (non-empty) list of circuit inline
elements optional as a whole.
2021-10-19 17:46:51 -07:00
Eric McCarthy
3b1ab8fd3e [ABNF] Regenerate markdown. 2021-10-15 18:38:10 -07:00
Eric McCarthy
e4eae37653 sort the Go to links so that small changes do not yield so many irrelevant differences 2021-10-15 18:34:14 -07:00
Alessandro Coglio
003758cdad [ABNF] Re-generate the markdown. 2021-09-24 15:46:33 -07:00
Alessandro Coglio
cc46ec060f [ABNF] Remove 'string' from the keywords.
Now that the stdlib includes the type alias declaration

type string = [char; _];

in order for that type declaration to be legal and not "special", 'string' must
be an identifier.
2021-09-24 15:43:16 -07:00
Mazdak Farrokhzad
3ad7d2fdb2 cleanup courtesy of clippy 2021-09-23 17:06:48 +02:00
Alessandro Coglio
a5f74195cf
Merge pull request #1333 from AleoHQ/array-len-function
[Feature] Adds .len() postfix to arrays
2021-09-15 10:10:32 -07:00
damirka
4f41f09ef2 Merge branch 'master' into array-len-function 2021-09-13 14:26:38 +03:00
damirka
093517109b renaming, now .length() 2021-09-10 16:11:55 +03:00
Alessandro Coglio
1c4c7622f3 [ABNF] Re-generate markdown file. 2021-09-09 12:00:22 -07:00
Alessandro Coglio
ba65b4f4d5 [ABNF] Improve rules for array expressions.
Extending array dimensions for types to allow underscore has the unintended
effect of allowing that also for expressions. This is not necessarily an error,
as the static semantics can rule out underscores from array expressions.
However, it is a simple syntactic constraint that is best captured by the
grammar.

This commit differentiate array dimensions for types and array dimensions for
expressions, using them in the appropriate places.
2021-09-09 11:55:30 -07:00
Alessandro Coglio
fe77354db7 [ABNF] Re-generate markdown file. 2021-09-06 13:17:19 -07:00
Alessandro Coglio
e9d61ab519 [ABNF] Regenerate markdown. 2021-09-06 13:13:26 -07:00
Alessandro Coglio
593aac5636 [ABNF] Incorporate change for unspecified array sizes.
That change was made on master concurrently with this PR. This commit integrates
the concurrent changes.
2021-09-06 13:10:55 -07:00
Alessandro Coglio
dab6f494b1 [ABNF] Improve formulation of rule for types.
As discussed on GitHub, list identifiers separately from Self.

Also adapt and improve some of the documentation comments.
2021-09-06 13:08:31 -07:00
Alessandro Coglio
b45a722d6b [ABNF] Move two rules within file.
No content change, just layout change.

Prepares for next change to the file.
2021-09-06 13:02:20 -07:00
damirka
ab50d81473 changes abnf grammar 2021-09-03 14:36:55 +03:00
Alessandro Coglio
2426fada7d [ABNF] Re-generate markdown. 2021-09-02 22:05:44 -07:00
Alessandro Coglio
1c18f4c56d [ABNF] Improve nomenclature.
Replace 'circuit-or-alias-type' with 'identifier-or-self-type'.

This makes the nomenclature for types more clear and extensible:

- A type may be an identifier, which may be the name of a circuit type or the
  name of a type alias.

- In the future, an identifier used as a type could refer to other kinds of
  types that we may add, such as enumerations.

- While both 'alias type' and 'type alias' could be acceptable terms, it seems
  best to standardize on 'type alias': the latter describes an alias of a type
  (which is the right concept), while the former suggests a type of the "alias"
  kind (cf. 'circuit type', 'field type', 'integer type', etc.). Type aliases
  are not another kind of types like the other: they are aliases of (any of)
  those kinds of types. So by not having 'circuit-or-alias-type' we avoid
  suggesting a notion of 'alias type'.

This does not change the language described by the grammar, it merely changes
some nomenclature in the grammar. Thus, no change to the parser is
needed. Aligning the nomenclature in the abstract syntax and parser to the ABNF
would be good, but entirely optional at this point.
2021-09-02 21:54:42 -07:00
Alessandro Coglio
f984a47b87 [ABNF] Re-generate markdown. 2021-08-27 11:19:50 -07:00
Alessandro Coglio
cdde46e2f3 [ABNF] Remove keywords 'true' and 'false' again.
These were removed in a previous commit, because they are already classified as
(boolean) literals, but they were accidentally re-introduced, presumably due to
the type alias RFC referencing the previous version of the keyword grammar rule.
2021-08-27 10:31:02 -07:00
gluaxspeed
abd2919891 include grammar changes from pr 1290, regenerate md 2021-08-25 08:05:48 -07:00
gluaxspeed
e90228b295 type aliases 2021-08-19 06:04:44 -07:00
Alessandro Coglio
30da9d6e1c [ABNF] Re-generate the markdown file. 2021-08-16 18:07:26 -07:00
Alessandro Coglio
80e2b14c8c [ABNF] Fix rule for conditional expressions.
The test of the expression should have been a disjunctive expression. This was
an oversight when the rules were written.
2021-08-16 18:06:27 -07:00
Alessandro Coglio
a2919e9dd7 [ABNF] Re-generate the markdown. 2021-08-02 18:01:22 -07:00
Alessandro Coglio
33831779c7 [ABNF] Rename digit => decimal-digit.
Since, with the introduction of (ASCII and Unicode escapes for) characters, we
now have digits in base 10, 8, and 16, it seems worth being more explicit in the
naming of decimal digits in the grammar.

Just a nonterminal name change, not a structural change to the grammar.
2021-08-02 17:59:13 -07:00
Alessandro Coglio
14f0163d2c [ABNF] Move a rule and update some comments.
Move the rule for 'digit' just before the ones for 'octal-digit' and
'hexadecimal-digit'.

Update the comments accordingly.

No real change to the grammar here.
2021-08-02 17:56:47 -07:00
Alessandro Coglio
15599c71ce
Merge pull request #1212 from AleoHQ/abnf
[ABNF] Add a rule for lexemes (i.e. lexical units).
2021-07-30 17:26:18 -07:00
howardwu
c37d7bcd39 chore(leo): bump version for new release 2021-07-29 18:59:08 -07:00
Alessandro Coglio
70c6af11c5 [ABNF] Re-generated the markdown file. 2021-07-28 16:33:44 -07:00
Alessandro Coglio
6f03b9df26 [ABNF] Add a notion of lexeme.
This is just for nomenclature. It does not change the language or anything.
2021-07-28 16:33:14 -07:00
gluaxspeed
745f6c2275 variable shadow error 2021-07-27 13:39:34 -07:00
Alessandro Coglio
fe5e4a00cf [ABNF] Fix generated file name. 2021-07-27 09:39:41 -07:00
Alessandro Coglio
ac65ffd67e [ABNF] Regenerate the markdown for the ABNF grammar. 2021-07-26 21:16:34 -07:00
Alessandro Coglio
ecadb3c321 [ABNF] Make the lexical grammar slightly less ambiguous.
Before this commit, 'true' and 'false' were both keywords and boolean literals,
making the grammar slightly more ambiguous than it needs to be. This manifests
in the formal specification of lexing and parsing, which would need an
additional extra-grammatical predicate requiring 'true' and 'false' to be
boolean literals and not keywords. By making 'true' and 'false' just boolean
literals, we obviate that need.

Extend the comment about identifiers and package names not being keywords or
aleo1... to also exclude boolean literals.

This is similar to the grammar of Java, in which 'true', 'false', and 'null' are
not keywords.

This does not necessitate any change to the lexer/parser, which already performs
its own procedural disambiguation of this and other aspects of the grammar.
2021-07-26 21:12:30 -07:00
gluaxspeed
8ae89149a9 ABNF grammar update 2021-07-23 17:36:27 -07:00
gluaxspeed
3a6e4cb994 be more specific of where this grammar applies, clean up 2021-07-21 20:00:44 -07:00
gluaxspeed
dd67004af7 remove old abnf comments, format abnf 2021-07-21 14:42:25 -07:00
gluaxspeed
a9593971b9 format string and grammar changes 2021-07-20 14:52:35 -07:00
damirka
052b0a142b patch abnf to 0.12.0, uncomment leo-abnf crate 2021-07-17 02:37:34 +03:00
Alessandro Coglio
bceefa621d [ABNF] Fix typo in comments. 2021-07-15 21:44:27 -07:00
Alessandro Coglio
6c071eda01 [ABNF] Re-generate markdown file. 2021-07-15 15:50:22 -07:00
Alessandro Coglio
baace61e21 [ABNF] Add some comments.
Add to the rule for package names, as a comment, the same exclusion added to the
rule for identifiers. Also add a few lines to describe it.

Also discuss the disambiguation of identifiers and package names.
2021-07-14 22:09:28 -07:00
gluaxspeed
d983467b01 Fix package-name in abnf 2021-07-06 11:57:24 -07:00
gluax
bcb50ae27f change equality_expressions 2021-07-01 13:40:29 -07:00
gluax
eee9cfc1be fix parser to match abnf conditional 2021-06-30 22:20:06 -07:00