Commit Graph

2795 Commits

Author SHA1 Message Date
Louis Gesbert
c92fe5e72d Fix underline of code errors when code contains utf8 2022-11-28 16:38:09 +01:00
Louis Gesbert
af2f5dbe19 Tweak error message location printing 2022-11-28 16:38:09 +01:00
Louis Gesbert
9fc4c0c10c Define Catala_utils.String as an overlay to stdlib string 2022-11-28 16:38:09 +01:00
Louis Gesbert
660e5775de Rename utils to catala_utils 2022-11-28 16:38:09 +01:00
Louis Gesbert
b329afbbdb Rename all Map/Set calls accordingly
This is just a bunch of `sed` calls:
```shell
sed -i 's/ScopeSet/ScopeName.Set/g' compiler/**/*.ml*
sed -i 's/ScopeMap/ScopeName.Map/g' compiler/**/*.ml*
sed -i 's/StructMap/StructName.Map/g' compiler/**/*.ml*
sed -i 's/StructSet/StructName.Set/g' compiler/**/*.ml*
sed -i 's/EnumMap/EnumName.Map/g' compiler/**/*.ml*
sed -i 's/EnumSet/EnumName.Set/g' compiler/**/*.ml*
sed -i 's/StructFieldName/StructField/g' compiler/**/*.ml*
sed -i 's/StructFieldMap/StructField.Map/g' compiler/**/*.ml*
sed -i 's/StructFieldSet/StructField.Set/g' compiler/**/*.ml*
sed -i 's/EnumConstructorMap/EnumConstructor.Map/g' compiler/**/*.ml*
sed -i 's/EnumConstructorSet/EnumConstructor.Set/g' compiler/**/*.ml*
sed -i 's/RuleMap/RuleName.Map/g' compiler/**/*.ml*
sed -i 's/RuleSet/RuleName.Set/g' compiler/**/*.ml*
sed -i 's/LabelMap/LabelName.Map/g' compiler/**/*.ml*
sed -i 's/LabelSet/LabelName.Set/g' compiler/**/*.ml*
sed -i 's/ScopeVarMap/ScopeVar.Map/g' compiler/**/*.ml*
sed -i 's/ScopeVarSet/ScopeVar.Set/g' compiler/**/*.ml*
sed -i 's/SubScopeNameMap/SubScopeName.Map/g' compiler/**/*.ml*
sed -i 's/SubScopeNameSet/SubScopeName.Set/g' compiler/**/*.ml*
```

... and reformat
2022-11-28 16:38:09 +01:00
Louis Gesbert
0030fac7c4 Remove previous set/map definitions 2022-11-28 16:38:09 +01:00
Louis Gesbert
206a24a3e1 Factorise definitions of set and maps for uids 2022-11-28 16:38:09 +01:00
Louis Gesbert
8a4462f6cc Name resolution: small reformatting 2022-11-28 16:38:09 +01:00
Denis Merigoux
d7b9396e87
Correct lines 2022-11-24 15:17:00 +01:00
Louis Gesbert
4f059883c1
Uniformise naming of conversion modules across compilation passes (#358) 2022-11-23 18:53:50 +01:00
Louis Gesbert
47799ea24f Uniform naming of conversion modules across compilation passes 2022-11-22 12:08:18 +01:00
Louis Gesbert
6ecca5c664
AST refactoring (#356) 2022-11-22 11:08:11 +01:00
Louis Gesbert
4dfb4ab44f Add some more doc for Expr.shallow_fold and Expr.map_gather 2022-11-21 17:54:17 +01:00
Louis Gesbert
a5ea9451bc Fix extra spacing in struct printer 2022-11-21 17:11:53 +01:00
Louis Gesbert
4ae392c900 AST refactoring
Many changes got bundled in here and would be too tedious to separate.

Closes #330

See changes in `shared_ast/definitions.ml` to check the main point.

- the biggest change is a modification of the struct and enum types in
  expressions: they are now stored as `Map`s throughout passes, and no longer
  converted to indexed lists after scopelang. Their accessors are also changed,
  and tuples only exist in Lcalc (they're used for closure conversion).

  This implied adding some more information in the contexts, to keep the mapping
  between struct fields and scope output variables. It should also be much more
  robust (no longer relying on assumptions upon different orderings).

- another very pervasive change is more cosmetic: the rewrite of the main AST to
  use inline records, labelling individual subfields.

- moved the checks for correct definitions and accesses of structures from
  `Scope_to_dcalc` to `Typing`

- defining some new shallow iterators in module `Shared_ast.Expr`, and
  factorising a few same-pass rewriting functions accordingly (closure
  conversion, optimisations, etc.)

- some smaller style improvements (ensuring we use the proper compare/equal
  functions instead of `=` in a few `when` closes, for example)
2022-11-17 18:16:09 +01:00
Louis Gesbert
8d7f2152a6 Fill in lambda types when doing type inference 2022-11-17 17:47:24 +01:00
Denis Merigoux
4391cd2a1e
Merge branch 'master' into afromher_334 2022-11-17 15:31:29 +01:00
Denis Merigoux
35e606f155
Do not duplicate the tracking of types of free variables in verification backend (#355) 2022-11-17 15:30:51 +01:00
Aymeric Fromherz
1d0871e65c format 2022-11-16 22:28:20 +01:00
Aymeric Fromherz
cfba9d456a Merge branch 'afromher_verif' into afromher_334 2022-11-16 22:16:11 +01:00
Aymeric Fromherz
16c9bae810 cleanup unused var/module errors 2022-11-16 22:13:14 +01:00
Aymeric Fromherz
fe9ef4f8cb Remove map of free_vars_typ from VC generation 2022-11-16 22:08:07 +01:00
Aymeric Fromherz
5a5003b22d Do not pass free_vars to make_context 2022-11-16 21:59:48 +01:00
Aymeric Fromherz
0ccf7da89a Remove ctx_var from Z3 backend context 2022-11-16 21:57:26 +01:00
Aymeric Fromherz
1343f9e1f6 Leverage typed information embedded in expressions to remove uses of the ctx_var map 2022-11-16 21:55:31 +01:00
Aymeric Fromherz
5c19bdc0db Store typ in z3_vars map 2022-11-16 21:52:14 +01:00
Aymeric Fromherz
43fa3ba550 Start removing ctx_var 2022-11-16 21:36:21 +01:00
Catala nix updated
f7fd02266e update lock files 2022-11-14 00:24:07 +00:00
Aymeric Fromherz
e37ad1de44 Reset tests 2022-11-08 22:28:02 +01:00
Aymeric Fromherz
63572b6963 Add bad test for assertions 2022-11-08 22:27:17 +01:00
Aymeric Fromherz
4af44fb519 Add debug info about encoded assertions 2022-11-08 22:25:07 +01:00
Aymeric Fromherz
c4756c485c WIP: Encoding assertions to Z3 2022-11-08 22:09:35 +01:00
Aymeric Fromherz
b443174033 Better handling of assertions in conditions.ml 2022-11-08 22:09:21 +01:00
Aymeric Fromherz
fee9533b87 Add local asserts to each generated vc 2022-11-08 21:51:56 +01:00
Aymeric Fromherz
3c478148e1 Basic infrastructure for collecting assertions 2022-11-08 20:55:40 +01:00
Aymeric Fromherz
5f36bee94f Extend verification_condition with field for assertions in scope 2022-11-08 20:48:43 +01:00
Aymeric Fromherz
9ad7362381 Add testcase from issue 2022-11-08 20:38:09 +01:00
Denis Merigoux
b49e32cb59
Use scope calls in "Aides logement" (#352) 2022-11-07 16:18:03 +01:00
Denis Merigoux
9b8fa73c8e
Fancier error messages (#351) 2022-11-07 14:26:54 +01:00
Louis Gesbert
a51d082033 Use scope calls in "Aides logement" 2022-11-07 14:23:10 +01:00
Louis Gesbert
f8f1ae283f Scopelang printer: use 'struct'/'enum' rather than 'type' 2022-11-07 14:13:03 +01:00
Louis Gesbert
4d4dac6727 Some fancy unicode for error outlines
Normally I would make sure this is not by default, or at leat disableable; but
here the code we print may contain utf8 anyway, so the terminal really needs to
support it. Anyway, it's just a little fancier, doesn't add much.
2022-11-07 14:13:01 +01:00
Louis Gesbert
429911024c Add parseable line-column info to error messages
a quick fix for now, ideally we want an option for editor-friendly output.
But for now this is a very cheap way to at least have clickable error messages
which are a big time-saver.
2022-11-07 14:03:38 +01:00
Catala nix updated
419e68bbc8 update lock files 2022-11-07 00:25:07 +00:00
Louis Gesbert
9e69273141 Location printer: avoid trailing whitespace 2022-11-04 11:24:41 +01:00
Louis Gesbert
8f08080f6f
Make scopes directly callable (#349) 2022-11-04 11:05:29 +01:00
Louis Gesbert
3e004551fc Callable scopes: fixes following review 2022-11-03 15:18:51 +01:00
Catala nix updated
e50fedb677 update lock files 2022-10-31 00:30:37 +00:00
Louis Gesbert
47a1258648 Fix error handling of invalid subscope variable assignments 2022-10-27 11:42:55 +02:00
Louis Gesbert
96b623c724 Subscope calls: fix handling of input variables with multiple states 2022-10-27 11:42:27 +02:00