Commit Graph

248 Commits

Author SHA1 Message Date
Christian Rinderknecht
dad9b0f816 Refactoring of the AST and simplfier of PascaLIGO.
Some weeks ago, anonymous functions as expressions were added to
PascaLIGO, unfortunately in a manner that allowed in theory for
contexts in which a named function was found when an anonymous was
expected, and vice-versa. That explains that the simplifier had two new possible errors:

   * unexpected_anonymous_function
     ("you provided a function declaration without name")
   * unexpected_named_function

I changed the AST and the parser so that function expressions
correspond to anonymous functions (without block) and function
declarations correspond to named functions.

I also removed a error in the simplifier, which was unused:

   * bad_bytes
     ("you provided a function expression with a name (remove it)")
2020-01-09 17:26:07 +01:00
Suzanne Dupéron
13ff600509 union-find: rename partition to UnionFind for more consistency across the various names that opam and dune assign to this library 2020-01-08 18:12:00 +00:00
Suzanne Dupéron
dd9a4dfb47 update union-find library (part 2: adjust module names) 2020-01-08 18:12:00 +00:00
Suzanne Dupéron
5e444dd278 update union-find library (part 1: remove old copy, download https://github.com/rinderknecht/UnionFind.git 3fc434d0d75e40d40d17f5abb70d86a51f434771 in new folder) 2020-01-08 18:12:00 +00:00
Christian Rinderknecht
6a1939553e Added --messages. 2020-01-07 22:26:47 +00:00
Lesenechal Remi
a0a8f114c0 replaces remove_from by take which does not raise any exceptions 2020-01-06 19:24:41 +01:00
Lesenechal Remi
7e05b7d276 now removes the entry-point declaration from the program before aggregation 2020-01-06 18:41:53 +01:00
Christian Rinderknecht
1806d6d74c Merge remote-tracking branch 'origin/dev' into rinderknecht-dev 2020-01-03 16:58:37 +01:00
Lesenechal Remi
e834e2ac20 More informative errors when calling michelson typecheck function 2020-01-03 15:25:37 +01:00
Christian Rinderknecht
345ffe22e4 Improved formatting of error messages (EOF is handled now). 2020-01-02 15:08:14 +01:00
Christian Rinderknecht
ea4eb76013 I added support for unlexing to CameLIGO. Fixed cover.sh. 2019-12-26 13:23:32 +01:00
Christian Rinderknecht
705b425589 Merge remote-tracking branch 'origin/dev' into rinderknecht-dev 2019-12-20 16:46:33 +01:00
Christian Rinderknecht
072dea757c [WIP] Adding the infrastructure for supporting the incremental API of Menhir.
* I added CLI option "--mono" to select the monolithic API of Menhir.
  * I added a field "win" to the state of the lexer (a two-token
    window for error reporting).
  * I escaped LIGO strings before making them OCaml strings (for
    example for printing).
2019-12-20 16:44:03 +01:00
Lesenechal Remi
2086dd9ab5 add predecessor timestamp to the CLI 2019-12-20 12:18:36 +01:00
Lesenechal Remi
92523bc4a5 exposing context type to be able to modify the timestamps in the tests 2019-12-20 12:18:36 +01:00
Tom Jack
d7bea52d44 Unignore dune-project 2019-12-19 19:53:10 +00:00
Christian Rinderknecht
9512992d2b Generating .msg files and extracting from them LIGO source files. 2019-12-18 22:17:49 +00:00
Tom Jack
172038cef0 Kill warning 45 by reusing Pervasives.result for Trace 2019-12-18 21:20:35 +00:00
Christian Rinderknecht
dfcdc54965 Merge branch 'dev' of gitlab.com:ligolang/ligo into rinderknecht-dev 2019-12-18 21:22:38 +01:00
Christian Rinderknecht
00f2e253f3 Generating .msg files and extracting from them LIGO source files. 2019-12-18 21:21:39 +01:00
Lesenechal Remi
ea343760b2 compile_parameter and compile_storage CLI commands now gets their input checked 2019-12-18 16:47:23 +01:00
Lesenechal Remi
46623ceb77 contract are now typecheck (at least in the CLI) 2019-12-10 15:58:53 +01:00
Lesenechal Remi
385961503f add unparse_ty to ligo-utils (thanks alpha monad) 2019-12-10 15:58:53 +01:00
Sander
95a7e19be6 Add ReasonLIGO support 2019-12-10 13:47:31 +00:00
Christian Rinderknecht
6cc17f9a3f I rewrote some comments so [dune build @doc] can extract HTML from
module interfaces.

This is meant as an exercise and an example to all team members.

I fixed a minor shadowing issue in [x_list.ml].
2019-12-07 15:09:49 +00:00
Pierre-Emmanuel Wulfman
034c92a64c Use ADT for types and move type to ast_common
and Making name, type_variable, built-in, constructor, label and string uncompatible types in ligo (weird bug with types in ligodity)
2019-12-04 11:40:58 +00:00
Tom Jack
66d2cda107 Mini_c: Inlining optimization 2019-11-27 09:06:31 -06:00
Tom Jack
f7ef0472be Add command for measuring contracts 2019-11-25 17:36:22 -06:00
Tom Jack
dbb36e6fdc Use runtest to run tests 2019-11-21 12:28:38 -06:00
Tom Jack
81c49f4342 Fix/simplify big_maps using Babylon 2019-11-21 08:18:18 -06:00
Lesenechal Remi
f27f8c10d1 For collection loop: also capture variable in logical blocks
Also, the iterated element/s are appended tot he list of local declaration
2019-11-21 11:28:32 +01:00
Lesenechal Remi
725176a59d allow to pack message (aka lambda of type unit -> operation list) 2019-11-19 23:27:43 +01:00
Lesenechal Remi
f7d6a5ea58 allow to catch failwith's in our tests 2019-11-19 15:38:23 +01:00
galfour
ddc4b7b7a5 add anon functions; remove pre-block declarations; update tests 2019-11-18 16:10:48 +01:00
Christian Rinderknecht
759978393a Merge branch 'rinderknecht-dev' into 'dev'
Refactoring of PascaLIGO's front-end

See merge request ligolang/ligo!176
2019-11-06 17:17:02 +00:00
Christian Rinderknecht
fe90246e3a Fixed the printing of some AST nodes. 2019-11-06 17:23:49 +01:00
Christian Rinderknecht
70a9afcce2 Merge branch 'rinderknecht-dev' into 'dev'
Refactoring of Ligodity (CameLIGO) and making an AST pretty-printer

See merge request ligolang/ligo!172
2019-11-06 12:18:54 +00:00
Christian Rinderknecht
351025b52d Refactoring of Ligodity (CameLIGO) and making an AST pretty-printer
- AST.ml/AST.mli:
  - The AST now distinguishes the constructors `None` and `Some` as being
    predefined, as in PascaLIGO. See type `AST.constr_pattern`.
  - I removed the nodes specific to Liquidity,
    e.g. `let%entry`, and, in particular, the natural literals
    ending with `p`. Now it should be `n`, as in `10n`.
  - I renamed the node `TAlias` to `TVar`.
  - I have applied the rule of expanding type expressions after `of` when
    those were not records.
  - The type of the argument to a data constructor is now
    `type_expr`, instead of `cartesian`.
  - I added the patterns for bytes (`PBytes`) and natural literals (`PNat`).
  - I renamed the node `Sugar` into
    `PListComp` (meaning "pattern of list comprehension").
  - Record types in CameLIGO now must have at least one field declaration.
  - Replaced the type `closing` and `opening` with one type `compound`,
    which captures only the right combinations of opening and closing.
  - Components of tuples in a selection must not be written
    between parentheses. For example, `a.b.(1).(0)` is now
    `a.b.1.0`, as in PascaLIGO.
- LexToken.mli/LexToken.mll
  - I renamed the string literal `Str` into `String`.
  - I added the tokens `C_None` and `C_Some` (to distinguish the
    constructors `None` and `Some`. See AST.ml)
  - Fixed the function `mk_sym` so it does not fail with `failwith`, but
    with `Error Invalid_symbol`.
- Lexer.mll (shared)
  - I removed the character `%` from the identifiers (used to
    support Liquidity, like `entry%point` and `match%nat`).
  - I adde to the hint on broken strings: "or insert a backslash"
    (from a Gitlab issue).
- ParToken.mly
  - I added the tokens `C_None` and `C_Some` (to distinguish the
    constructors `None` and `Some`. See AST.ml and LexToken.mll)
- Parser.mly
  - Fixed the order of declarations in the AST (it was reversed).
  - I removed syntax support for Liquidity.
  - I added user-defined constructor applications to irrefutable
    patterns (the ones afer a `let`), even though only the type
    checker can decide that they are truly irrefutable because they
    are the only constructors of their types.
  - I added natural numbers and bytes to patterns.
  - Access of tuple components do not require parentheses now, like
    `a.b.1.0`.
  - I refactored the semantic actions.
  - I added the empty sequence `begin end`.
- ParserLog.ml/ParserLog.mli
  - I added a pretty-printer for the AST (with source locations).
- ParserMain.ml
  - The CLI for the pretty-printer is now `--verbose=ast`.
  - The old CLI `--verbose=ast` is now `--verbose=ast-tokens`.
- ligodity.ml (simplifier)
  - I removed the constructions of sets, lists and maps with
    `Set [...]`, `List [...]` and `Map [...]`, as there are already
    better ways (that is, more like the OCaml's way), like
    `Set.literal [...]` and `Map.literal [...]`. (The case for lists
    was entirely redundant with the rest of the language as it is.)
  - Everywhere there is now a non-empty list of elements, I made a
    change. In particular, I removed a corner case ("let without
    binding"), thanks to more precise OCaml types for non-empty
    lists.
  - I ported all the changes to the AST above.
- region.ml (vendors)
  - I changed the method `compact` so the end-line is not repeated
    if it is the same as the start line: this is even more compact. I
    use this in the new pretty-printer for the AST (see above)
- I updated all the CameLIGO contracts.
2019-11-04 23:51:47 +01:00
galfour
9fe5d821c3 Merge branch 'dev' into clean-sts-solver 2019-11-04 16:32:32 +01:00
Tom Jack
ba7a83d0f7 Deal with upstream MBytes changes 2019-11-02 17:54:33 -05:00
Tom Jack
b06f4d3f62 Delete protocol tests 2019-11-02 17:54:21 -05:00
Tom Jack
f739624185 Prepare for tezos upgrade 2019-11-02 17:38:39 -05:00
Suzanne Dupéron
1e06c24325 Merge branch 'dev' of gitlab.com:ligolang/ligo into clean-sts-solver 2019-10-31 17:18:09 -04:00
Tom Jack
58638c6a05 Merge branch 'feature/hex' into 'dev'
Add hex michelson output, use enums for format options

See merge request ligolang/ligo!162
2019-10-31 15:39:03 +00:00
Suzanne Dupéron
735bd8e668 Implementing subst over the AST 2019-10-29 01:55:53 -04:00
Suzanne Dupéron
dcf5a975d4 More of subst 2019-10-28 01:10:26 -04:00
Tom Jack
6956e8751d Add hex michelson output, use enums for format options 2019-10-26 12:57:22 -05:00
Tom Jack
dae4f58297 Combine adjacent DROP 2019-10-24 23:58:21 -05:00
galfour
27be6cfcba use apply for closures 2019-10-17 16:34:02 +02:00
galfour
8a4b9695e7 use dig/dug for get/set 2019-10-17 15:48:24 +02:00