Commit Graph

5034 Commits

Author SHA1 Message Date
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
Galfour
66974949b2 first working example of the whole pipeline 2019-03-21 21:37:44 +00: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
Galfour
0975f71059 tmp 2019-03-21 14:53:09 +00:00
Christian Rinderknecht
fa8adb9bde
Restricted types of parameters to cartesian types. 2019-03-21 15:09:35 +01:00
Christian Rinderknecht
3b318d0f06
Renamings. 2019-03-21 12:55:24 +01:00
Galfour
8819422542 pre big modif 2019-03-20 22:04:39 +00:00
Christian Rinderknecht
abbebbf0f6
Refactoring of the AST. 2019-03-20 21:36:12 +01:00
Galfour
d23c49920c tmp 2019-03-20 17:25:32 +00:00
Galfour
a9f88e3ddf tmp 2019-03-20 17:06:12 +00:00
Christian Rinderknecht
aa117ecfc2
I removed dummy module [MBytes] an use [Hex] directly. 2019-03-20 17:48:57 +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
Galfour
1918bc00d1 tmp 2019-03-20 14:54:30 +00: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
bbb5966132
Merge branch 'master' into AST_with_records 2019-03-15 08:45:00 +01:00
Georges Dupéron
acf1706d3d more typechecker structure 2019-03-14 22:42:40 +01:00
Georges Dupéron
63be1b9b7d More of the type annotator structure 2019-03-14 22:11:27 +01:00
Georges Dupéron
bac4ce1024 More type annotator skeleton 2019-03-14 21:14:05 +01:00
Georges Dupéron
0943408463 SMap.t for records and sums 2019-03-14 20:42:41 +01:00
Georges Dupéron
8830f598df skeleton for a_types 2019-03-14 20:09:06 +01:00
Georges Dupéron
fb97b056ca Started structure for the type annotator 2019-03-14 20:00:01 +01:00
Georges Dupéron
7a84cf1c8b Removed If (missing in previous commit) 2019-03-14 19:32:36 +01:00
Georges Dupéron
8fc1729f47 If simplified to match 2019-03-14 19:30:55 +01:00
Georges Dupéron
adec2bb5e0 Cleanup 2019-03-14 19:23:37 +01:00
Galfour
fa4b570950 translations from typed-ligo to mini-c 2019-03-14 18:22:51 +00:00
Georges Dupéron
689673ccfa Single variable for ForCollect, set k=>v aside for now. 2019-03-14 19:14:10 +01:00
Georges Dupéron
90e894f9f4 Add missing regions 2019-03-14 19:02:41 +01:00
Georges Dupéron
76d4e1bb87 Distinguish function application from constructor application 2019-03-14 18:54:36 +01:00
Georges Dupéron
3bf5ad2819 Reformatted constant in AST2 to match that of Typecheck2 2019-03-14 18:45:38 +01:00
Georges Dupéron
ea0198388e Humour (bis) 2019-03-14 18:45:22 +01:00
Georges Dupéron
8200bff783 Temporary `TODO in place of regions 2019-03-14 18:42:21 +01:00