Commit Graph

46 Commits

Author SHA1 Message Date
Christian Rinderknecht
4476a2faba
Selections can be done now through tuples.
New syntax: a.2.b.4.2.x
where the numerals denote the component of a tuple.
2019-03-26 17:12:22 +01:00
Christian Rinderknecht
847a3a42b6
Refactoring for tuple expressions. 2019-03-26 15:51:28 +01:00
Christian Rinderknecht
c0800a64ef
Set membership is now a full-fledged expression.
It used to be tied to the test expression of a conditional.
2019-03-26 12:00:09 +01:00
Christian Rinderknecht
fef4337e83
Support for empty sets and maps. Alternate syntax for maps and lists:
sets, maps and lists are now homogeneous.

Lists by extension now require the "list" keyword, like sets and
maps. Semicolons needed, instead of commas.

New syntax for lists: `list [e_1; e_2; ...; e_n]`.

The empty list can now be denoted either by `list []` or `list end` or
`nil'.

Both `list` and `nil` are new keywords. Lists can also be denoted
without brackets, as sets and maps: `list e_1; e_2; ...; e_n end`.

The extension for maps follows the extension for sets: `map [b_1; b_2;
...; b_n]` or `maps b_1; ...; b_n end`.
2019-03-26 10:31:55 +01:00
Christian Rinderknecht
98f9d3e417
Extended conditional syntax for "else" clauses.
New syntax: if ... then ... else { ... }
2019-03-25 17:25:10 +01:00
Christian Rinderknecht
aced77e085
Added alternate syntax for conditionals in "then" clauses.
New syntax: if ... then { ... } else ...
2019-03-25 17:14:35 +01:00
Christian Rinderknecht
457a0085f7
I added and alternate syntax for blocks of instructions.
The syntax: block { ... }
The other syntax: begin ... end
This implies adding a new keyword to LIGO: "block".
2019-03-25 16:38:07 +01:00
Christian Rinderknecht
ea4af374f9
Removed braces from the lexer and parser. 2019-03-22 14:11:32 +01:00
Christian Rinderknecht
ad6cbf32eb
I added support for set membership.
Syntax: if s contains e then ... else
(only as a test expression in conditionals).
2019-03-21 23:45:19 +01:00
Christian Rinderknecht
19f6981ae7
I added an optional semi-colon before "else".
Syntax: if ... then ...; else ...
2019-03-21 23:18:09 +01:00
Christian Rinderknecht
c76ec00c9b
I added the patching of sets.
Syntax: patch s with set ... end
2019-03-21 23:12:46 +01:00
Christian Rinderknecht
98590b2e4a
Added support for removal from sets.
Syntax: remove e from set s
2019-03-21 23:01:21 +01:00
Christian Rinderknecht
f6dbd9d601
I added set definitions by extension.
For example:

const bar : set (int) = set 1; 1+1; f(3); end
2019-03-21 22:55:08 +01:00
Christian Rinderknecht
1e65c63d99
Added construct remove k from map m. 2019-03-21 21:55:59 +01:00
Christian Rinderknecht
285be32729
I added an optional semi-colon in record type declarations. 2019-03-21 21:34:22 +01:00
Christian Rinderknecht
fa8adb9bde
Restricted types of parameters to cartesian types. 2019-03-21 15:09:35 +01:00
Christian Rinderknecht
abbebbf0f6
Refactoring of the AST. 2019-03-20 21:36:12 +01:00
Christian Rinderknecht
495686bbd4
I extended the right-hand side of assignments to accept "None"
without type annotation.

This is meant to enable specify the removal of a map binding.

Note: The index assignments in loops are not concerned.
2019-03-20 16:19:33 +01:00
Christian Rinderknecht
24c0a33c99 I extended left-hand sides of assignments to have qualified paths.
Note: In loops over integers, the initial assignment has still a
variable (the index) as left-hand side.

A qualified path is of the form "x" or "x.y.z" or "x.y.z[t]".
2019-03-20 14:59:10 +01:00
Christian Rinderknecht
dc70df99f9
I added qualified names (paths) as left-hand sides of assignments.
For example:

store.funded := True;
2019-03-20 13:27:55 +01:00
Christian Rinderknecht
e8443937fd
Changed "||" -> "or" and "&&" -> "and" to be more Pascal-like. 2019-03-20 12:28:25 +01:00
Christian Rinderknecht
589b62a30c
Extended map expression to map constants by extension.
Fixed the grammar for variable declarations (the ":=" had been
disabled by mistake in the last commit).
2019-03-20 11:24:27 +01:00
Christian Rinderknecht
0768f0c27d
Ported to constant declaration the work done for variable declarations.
That is to say, now constants can include unannotated empty lists etc.
2019-03-20 10:06:33 +01:00
Christian Rinderknecht
563bc59285
Added qualified names to patches ("patch x.y.z with ...").
Fixed grammar for map patches (should start with "patch", not "map").
2019-03-20 09:45:32 +01:00
Christian Rinderknecht
60c23850bd
Small refactoring of the AST. 2019-03-20 09:26:24 +01:00
Christian Rinderknecht
8eaf1a90ec
Maps can be defined by extension in declarations.
"map" has become a keyword to introduce definition of maps by extension in declarations ("map" ... "end"). This entails that a grammar rule had to be created to handle the type expressions "map (..., ...)". Concordantly, I added map patches, modelled after record patches.

I created a node in the AST for map expressions (currently only
map look-ups).

I refactored the parser with parametric rules.
2019-03-20 09:11:19 +01:00
Christian Rinderknecht
4c9a743411
Replaced expression "copy ... with ..." by instruction "patch ... with". 2019-03-19 14:32:43 +01:00
Christian Rinderknecht
c3b304db4a
I relaxed the extension to the grammar that enabled non-annotated
empty lists and None values as initial values in declarations.

Now, these values are accepted irrespective of the declared type. It
is up to the typechecker to validate them.
2019-03-19 11:54:23 +01:00
Christian Rinderknecht
d994592a1b
Changed "match ... with ..." to "case ... of ..." 2019-03-19 11:46:30 +01:00
Christian Rinderknecht
6c5ae52db6
I relaxed the grammar to support in the parser for initial values of
variables to not require type annotation, like

var x : list (operation) := []
2019-03-19 10:52:47 +01:00
Christian Rinderknecht
46d6df2146
Changed "do nothing" to "skip". 2019-03-18 18:09:15 +01:00
Christian Rinderknecht
623683839f
Removed keyword "null", replaced by two keywords "do"
and "nothing".

Until now only products of type names were allowed: I extended
them to allow type expressions.

Removed the destructive update of a map binding "a[b] := c".

Record projection has been extended to allow for qualified
names: "a.b.c" and "a.b.c[d]".

Changed the LIGO extension from ".li" to ".ligo".

Fixed the name of the language to be "LIGO" (instead of "Ligo").
2019-03-18 17:47:11 +01:00
Christian Rinderknecht
ea02e4cffe
Added keyword "storage" as parameter kind (with "var" and "const") for
entrypoints.
2019-03-14 18:17:19 +01:00
Christian Rinderknecht
5f129d924a
Removed storage and operations declarations: entry-points now take the
former and return the latter.
2019-03-14 14:04:20 +01:00
Christian Rinderknecht
8e294a013c
Added assignment of a value to a map binding: m.[i] := v. 2019-03-14 13:19:52 +01:00
Christian Rinderknecht
c0e6843240
I added record creation (injection), field selection (projection)
and functional update (copy).

The only creative piece of concrete syntax is that of the
expression for functional updates:

copy foo with record field = value end

where "copy", "with", "record" and "end" are keywords.
2019-03-14 09:59:26 +01:00
Christian Rinderknecht
1f4f541a5b
Refactoring of the AST (more records, more structure). 2019-03-13 16:29:25 +01:00
Christian Rinderknecht
29df2ff9aa
Declarations can now be written in any order. Removed top-level block.
The parser exports now an entry rule for parsing Ligo expressions.
2019-03-11 12:51:50 +01:00
Christian Rinderknecht
8746802571
Storage and operations are now explicitly named.
Refactoring of AST to enable the detection of incomplete pattern
matchings by the OCaml compiler. Some record fields renamed for
better readability.
2019-03-10 19:41:27 +01:00
Christian Rinderknecht
7dcad4779e
I added entrypoints (and removed the parameter declaration).
I fixed the pretty-printing of strings.
2019-03-10 13:55:24 +01:00
Christian Rinderknecht
09f790680f
I extended the grammar with optional semicolons and vertical bars. 2019-03-07 17:06:02 +01:00
Christian Rinderknecht
ee8ff6ce41
Small refactoring. 2019-03-07 12:24:57 +01:00
Your Name
61575e13ea Merge commit '45d18f7' 2019-03-05 11:15:02 +01:00
Your Name
629bb48b8f Used records everywhere instead of objects. 2019-03-05 09:53:58 +01:00
Christian Rinderknecht
45d18f7b12
Added instruction 'fail'. I changed the grammar and AST for local functions and removed global mutable variables. 2019-02-28 15:46:34 +01:00
Galfour
9df0f6ad3a initial commit 2019-02-25 21:29:29 +00:00