Commit Graph

1288 Commits

Author SHA1 Message Date
Tom Jack
710f1699a6 Less dippy constants 2020-04-28 11:58:47 +02:00
Tom Jack
0895467f74 Less dippy application 2020-04-28 11:57:47 +02:00
Pierre-Emmanuel Wulfman
6b00a60986 done 2020-04-27 16:41:24 +02:00
Christian Rinderknecht
9618a48848 Merge branch 'dev' of gitlab.com:ligolang/ligo into rinderknecht@michelson 2020-04-25 20:51:33 +02:00
Christian Rinderknecht
f3777b4af8 The preprocessor library depends now on the kinds of comments
instead of a closed set of languages. I also removed the offsets:
I simply use the current region to determine whether the
preprocessing directie starts at the beginning of a line. I also
removed scanning line indicators, to make the lexer simpler.

LexToken.mll: Moved the function [check_right_context] that
checks stylistic constraints from Lexer.mll to
LexToken.mll. While this triplicates code (as CameLIGO, PascaLIGO
and ReasonLIGO share the same constraints), the benefit is that
Lexer.mll becomes more generic and the signature for the TOKEN
module is simpler (no more exporting predicates, except for
EOF). In accordance with the change of the preprocessor, the
lexers and parsers for LIGO now depend on the kind of comments,
not a fixed set of syntaxes. This gives more versatility when
adding a new language: only the kinds of its comments are needed,
although Lexer.mll and Preproc.mll may have to be modified if
they do not already know the comment delimiters, for example line
comments starting with #.

****************************************************************
BUG: The exceptions coming from LexToken.mll when a stylistic
constraint is broken in [LexToken.check_right_context] are not
caught yet.
****************************************************************

Lexer.mll: I moved out as much as I could from the header into a
new module LexerLib. The aim is to make it easy to reuse as much
as possible of the lexer machinerie, when it cannot be used as
is.
2020-04-24 21:06:18 +02:00
Pierre-Emmanuel Wulfman
8dfc8a0469 reorder generated variable in for_each 2020-04-23 18:01:07 +02:00
Pierre-Emmanuel Wulfman
30f2581f8b done 2020-04-23 17:53:10 +02:00
Pierre-Emmanuel Wulfman
ca3549bdee Merge branch 'optim/nested_record_update' into 'dev'
Optimize transpilation of nested record update

See merge request ligolang/ligo!510
2020-04-23 10:01:47 +00:00
Christian Rinderknecht
0e452ffbf1 Merge branch 'small-reasonligo-record-punning-improvement' into 'dev'
Make it possible to pun the first argument of a record.

See merge request ligolang/ligo!570
2020-04-22 17:13:01 +00:00
Tom Jack
c58e3220a7 fix bad sed 2020-04-22 12:04:21 -05:00
Tom Jack
b47b5b1c37 s/expression_eq/equal_variables/ to match the behavior 2020-04-22 11:44:57 -05:00
Pierre-Emmanuel Wulfman
2a8edb53da reduce expression_eq to equal variable 2020-04-22 11:42:53 -05:00
Pierre-Emmanuel Wulfman
1cbadbc7cf add expression_eq in ast_typed 2020-04-22 11:42:52 -05:00
Pierre-Emmanuel Wulfman
79f2df2314 optim for record 2020-04-22 11:41:33 -05:00
Tom Jack
1fbbc09313 promote (until-clean) (only *) ? 2020-04-22 11:38:40 -05:00
Pierre-Emmanuel Wulfman
3cb72f8ec2 add test 2020-04-22 15:05:33 +02:00
Pierre-Emmanuel Wulfman
c46210b656 fix order 2020-04-22 15:04:12 +02:00
Sander Spies
eafbe83151 Also promote ParErr.ml 2020-04-22 11:50:46 +02:00
Sander Spies
bd8cf09f9e Promote generated error files by dune. 2020-04-22 11:50:46 +02:00
Tom Jack
f67bd010c4 Treat transaction environment operators as impure 2020-04-22 10:30:57 +02:00
Pierre-Emmanuel Wulfman
54dadc33d6 move Var.reset_counter () to run_ligo 2020-04-21 18:06:19 +02:00
Pierre-Emmanuel Wulfman
0bf6d09e85 reset Var counter at the begening of cli run 2020-04-21 18:06:17 +02:00
Tom Jack
8066e4df26 Allow to failwith an int (or nat) 2020-04-21 15:35:41 +00:00
Tom Jack
5df005f4b7 Add print-mini-c --optimize=entrypoint to print optimized mini_c 2020-04-21 13:28:39 +00:00
Lesenechal Remi
5323475097 empty string singleton is not annotated anymore 2020-04-20 20:21:49 +02:00
Pierre-Emmanuel Wulfman
173a0c4031 Replace function that returns result by function that returns option 2020-04-20 17:39:36 +02:00
Lesenechal Remi
5622b52a36 updating tests 2020-04-19 15:20:02 +02:00
Lesenechal Remi
5bed9dadef WIP: michelson_pair 2020-04-19 15:18:46 +02:00
Lesenechal Remi
e94f445a51 michelson_or custom layout and annotations 2020-04-19 15:18:46 +02:00
Lesenechal Remi
5d35aaec58 add fold for ast_core 2020-04-19 15:18:46 +02:00
Tom Jack
f2a23029bd Always inline variable-for-variable lets in Self_mini_c 2020-04-16 14:18:35 -05:00
Tom Jack
6acf91a3f2 Perform basic eta contraction in Self_mini_c 2020-04-16 14:17:30 -05:00
Suzanne Dupéron
8848226b85 Merge branch 'bugfix-url-errors' into 'dev'
Fix link to docs in error message, closes LIGO-547

Closes LIGO-547

See merge request ligolang/ligo!573
2020-04-15 17:22:32 +00:00
Pierre-Emmanuel Wulfman
7a18cbd8fc Merge branch 'srcloc_for_types' into 'dev'
Add srcloc for Types

See merge request ligolang/ligo!562
2020-04-15 16:41:27 +00:00
Suzanne Dupéron
f547caa80f Fix link to docs in error message, closes LIGO-547 2020-04-15 18:04:43 +02:00
Pierre-Emmanuel Wulfman
7c29b075bb add srcloc for types 2020-04-15 17:38:42 +02:00
Sander Spies
2a24290ed0 Fix error messages. 2020-04-15 17:25:32 +02:00
Pierre-Emmanuel Wulfman
9796cd2e8f for loop have a optional step parameter 2020-04-15 17:25:31 +02:00
Sander Spies
990ae0e3a8 Make it possible to pun the first argument of a record. 2020-04-14 21:15:12 +02:00
Suzanne Dupéron
b7c3e77c82 Remove trailing whitespace while parsing in ADT generator 2020-04-14 17:11:50 +02:00
Sander Spies
422623ce1e Fix build. 2020-04-14 13:13:07 +02:00
Sander Spies
3e447c40b7 Merge 2020-04-14 13:11:44 +02:00
Suzanne Dupéron
741bfcf9b4 Merge branch 'feature/new-typer-rough-cleanup' into 'dev'
Rough cleanup of the new typer

See merge request ligolang/ligo!561
2020-04-14 11:10:26 +00:00
Christian Rinderknecht
f8c16e5764 Merge branch 'reasonligo-record-improvement' into 'dev'
Add support for record expressions of only one field.

See merge request ligolang/ligo!553
2020-04-14 11:01:11 +00:00
Christian Rinderknecht
5f4c5299d8 Merge branch 'more-api' into 'dev'
More api documentation improvements

See merge request ligolang/ligo!548
2020-04-14 10:53:11 +00:00
Sander Spies
2b82a74d93 Merge 2020-04-14 10:32:12 +02:00
Suzanne Dupéron
9e21123de0 Generic PP: use PPF, split test for parentheses to separate fold 2020-04-13 23:10:01 +02:00
Suzanne Dupéron
22fce03844 Improve a typer print 2020-04-13 23:10:01 +02:00
Suzanne Dupéron
1f0ab67baa Moved new typer's wrap module to a separate file 2020-04-13 23:10:01 +02:00
Suzanne Dupéron
93063d8c70 More cleanup new of the typer 2020-04-13 23:10:01 +02:00
Suzanne Dupéron
1b710bd952 Very rough cleanup new of the typer 2020-04-13 23:10:01 +02:00
Suzanne Dupéron
e001154714 with_xxx shorthands for fold configurations 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
b536d3f591 Remove early Perl 5 and Python versions of the ADT generator 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
ded76b41d6 Adt generator: split structure into smaller structures; use the monad; reordered function, state and value arguments to match the order of List.fold_left. 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
1e1728e5dd [WIP, does not build] Remove some polymorphism : customized visitors must be specific to their accumulator type 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
642c947ee4 [WIP, does not build] adt_generator move polymorphism into the fields, start getting rid of the large let rec 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
253da1e9f5 Break down the large fold_config structure into smaller structures 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
2991e48ce6 Implemented folds for the collections (lists and maps) 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
9639c2f775 WIP on making the AST compatibile with the ADT generator 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
ba9441a134 moved adt_generator tests to a separate folder 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
9d25773d61 Records in ast_typed for match_variant and declaration_constant 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
fcbcea9382 Turned some of the mathcing_content tuples into records 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
79593e6f3e Turned some of the tuples into records 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
58fc08b6a7 ADT generator: add support for open and include 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
516a3a85ff Inlined stage common in ast_typed (fix OCaml type errors) 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
b3b8fab26d [does not build] Inlined stage common in ast_typed 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
08aefa4580 Use unique field names in generic.ml and re-enable warning 30 there 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
12aec6edd0 Generic fold example: OCaml printer for an arbitrary ADT 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
a49f0806c0 ADT generator: produce info for metaprogramming 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
be38b5269c ADT generator: Stop promoting the generated file, because it breaks the build on the CI (why?) 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
ab8274eae2 Install perl6 instead of the painful-to-install python3+fstrings 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
20a51381bc ADT generator: Parser for OCaml ADTs, WIP on adding info 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
e92ba202cf Added Perl 5 and Raku (A.K.A. Perl 6) translations of the ADT generator. Their outputs are identical. 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
6585ce3a09 Install future-fstrings to get f-strings in Python 3.5 and earlier. 2020-04-13 19:23:12 +02:00
Suzanne Dupéron
2cbc8bbf0c Revert "Revert "Merge branch 'feature/adt-generator-poly-3' into 'dev'""
This reverts commit 8b83e375bd.
2020-04-13 19:23:12 +02:00
Christian Rinderknecht
1ccf6f247d Fixed format of syntax error messages. 2020-04-13 16:31:56 +02:00
Christian Rinderknecht
ffb3d05864 Changed a bit how syntax error messages are formulated.
Resolved a warning.
2020-04-13 14:19:56 +02:00
Christian Rinderknecht
af48efe195 Fix by Sander. 2020-04-13 14:03:30 +02:00
Christian Rinderknecht
f7b0c4fe6b Merge branch 'dev' of gitlab.com:ligolang/ligo into rinderknecht@preproc 2020-04-13 14:01:41 +02:00
Sander Spies
d9148699cc Fix contract tests 2020-04-13 13:58:58 +02:00
Sander Spies
6a6c8468a6 Remove annotations from michelson or. 2020-04-13 10:59:36 +02:00
Sander Spies
42b05c0437 Test tuples without annotations. 2020-04-13 10:31:09 +02:00
Sander Spies
a4a8e9d2bc Remove tuple annotation. 2020-04-13 10:24:40 +02:00
Christian Rinderknecht
b23b2d1dbb Plugged the preprocessor into the compiler's CLI. 2020-04-12 15:26:47 +02:00
Sander Spies
6f0fb02bf6 Ensure that the right error is called when using the wild pattern incorrectly. 2020-04-12 14:57:39 +02:00
Christian Rinderknecht
3ed303f60d In EvalOpt modules, the CLI input ["-"] is becomes now [None],
like the absence of an input filename. (This simplifies all the
clients codes.) Fixed the dune file for the preprocessor. Fixed
the build of PreprocMain.exe and PreprocMain.byte. Restricted
preprocessing errors [Preproc.Newline_in_string] and
[Preproc.Open_string] to the argument of the #include
directive (instead of general strings: this is for the LIGO lexer
to report the error). I removed the error [Preproc.Open_comment]
as this is for the LIGO lexer to report. The preprocessor scanner
[Preproc.lex] does not take a parameter [is_file:bool] now: the
source file (if any) is determined from the lexing
buffer. Accordingly, the field [is_file] of the state of the
preprocessing lexer has been removed: the lexing buffer becomes
now the reference for the input source (bug fix and interface
improvement). Fixed the comments of the test contract
pledge.religo. I removed the data constructor [Lexer.Stdin], as
redundant with [Lexer.Channel].
2020-04-09 16:18:26 +02:00
Christian Rinderknecht
46eecb4027 Marked the errors that should be skipped (because catched by the
LIGO lexer later). Added field [is_file] to the state of the
lexer to know if the input is a file or not (insert or not a
first line directive). Fixed ReasonLIGO comments in
entrypoints-contracts.md and website2.religo. WIP on the LIGO
lexer to properly handle comments for all the syntaxes.
2020-04-08 20:24:34 +02:00
Christian Rinderknecht
79967be726 Merge branch 'dev' of gitlab.com:ligolang/ligo into rinderknecht@preproc 2020-04-08 17:40:13 +02:00
Lesenechal Remi
f9d1928d8e michelson_or tests and changelog 2020-04-07 21:38:12 +02:00
Lesenechal Remi
be5ad35fb9 Force annotation for michelson_or 2020-04-07 21:36:59 +02:00
Lesenechal Remi
4af42cb1bd michelson_or types are transformed into variant types 2020-04-07 21:36:59 +02:00
Christian Rinderknecht
951348feb9 Deletion of Parser.msg 2020-04-07 19:56:52 +02:00
Christian Rinderknecht
53223e9d8e Cosmetics. 2020-04-07 18:57:43 +02:00
Christian Rinderknecht
a343989a6b Merge branch 'dev' of gitlab.com:ligolang/ligo into rinderknecht@preproc 2020-04-07 18:57:10 +02:00
Christian Rinderknecht
c0ee726fb2 Simple_utils is now used as a library by the local builds.
Preprocessor is now a library installed by opam.
Replaced ligolang@gmail.com by contact@ligolang.org in opam files.
Reformatted some opam files.
Removed #line directive from preprocessor.
Added to the interface of ParserUnit.
Script messages.sh now checks the identity of .msg and .msg.old
to avoid undue warning about possibly different LR items.
2020-04-07 18:33:46 +02:00
Pierre-Emmanuel Wulfman
79540f9a40 ediv implemented and tested; parser gives error 2020-04-06 18:23:26 +02:00
Sander Spies
38edf5ce74 Add support for record expressions of only one field. 2020-04-06 16:09:38 +02:00
Christian Rinderknecht
1941f9ae4b Shared more code in ParserUnit.ml
Rewrite of the integration of the preprocessor.
Compiles bt DOES NOT PASS THE CI.
2020-04-03 19:08:14 +02:00
Christian Rinderknecht
6c1a1f91e2 Removed error "Invalid directive" as PascaLIGO has the operator #. 2020-04-03 19:06:35 +02:00
Pierre-Emmanuel Wulfman
b41a59d2cf ast-imperative 2020-04-03 17:40:35 +02:00