Louis Gesbert
4caf828e48
Additional cleanup/fixes on the compiler refactoring
...
following review ^^
2022-08-23 00:13:02 +02:00
Louis Gesbert
576e0fb3ff
Factorise AST printers
...
Note that there were significant differences between the two printers (see the test diff!). Overall the `dcalc` one seemed newer so that's what I took, with only the required additions from `lcalc` (exceptions, raise and catch)
2022-08-22 19:28:27 +02:00
Louis Gesbert
06dbab74d2
reformat
2022-08-22 19:28:27 +02:00
Louis Gesbert
2b6ee8dd4b
Leverage the shared AST: big cleanup (part I)
2022-08-22 19:28:21 +02:00
Denis Merigoux
755b1212a2
Remove division durations
2022-08-19 15:21:29 +02:00
Denis Merigoux
e5aed3efcb
Merge branch 'master' into rmonat_dates_calc_lib
2022-08-19 14:59:46 +02:00
Denis Merigoux
2c40802c57
Fix again line numbers in HTML
2022-08-16 11:46:20 +02:00
Denis Merigoux
038e6068e6
Small improvements to housing benefits
2022-08-10 18:13:07 +02:00
Denis Merigoux
228b6c830a
Fix line numbers in LaTeX and HTML with leading comments in code
2022-08-10 10:45:49 +02:00
Louis Gesbert
f35f18b295
Add local 'let in' bindings
2022-08-09 12:17:31 +02:00
Raphaël Monat
ffd2e1dec3
Merge branch 'master' into dates_calc_lib
2022-08-06 17:26:55 +02:00
Louis Gesbert
c964495c59
Generate website assets through dune
2022-08-03 19:04:13 +02:00
Louis Gesbert
0abbb3e29b
Syntax: tweak priority of 'set contains elt'
...
(the other way around was creating a conflict !)
2022-08-02 10:02:03 +02:00
Louis Gesbert
3987e446e9
Add polish translation for new "contains" keyword
2022-07-28 10:34:37 +02:00
Louis Gesbert
6d41818e0a
Change syntax for set membership predicate
...
Before: `ELEMENT in SET`; now: `SET contains ELEMENT`
Using the `in` keyword was causing conflicts and blocking #203 .
Current proposal has `contient` for the French syntax, and is untranslated (`contains`) for Polish.
2022-07-27 14:34:58 +02:00
Denis Merigoux
fa55a83fb4
Merge branch 'master' into 290-jsoo-wrapper-plugin
2022-07-22 17:54:51 +02:00
Emile Rolley
0c180e12f9
refactor(runtimes): add runtime_ocaml and runtime_jsoo in the catala package
2022-07-22 16:52:56 +02:00
Denis Merigoux
dc00ce8957
Merge branch 'master' into aides_logement
2022-07-22 16:49:01 +02:00
Denis Merigoux
3895743f20
Cleaned code for generating exception graph, now correct and fully general
...
Missing some encoding optimizations
2022-07-22 12:25:41 +02:00
Denis Merigoux
100c84a741
Allow negative literals
2022-07-21 14:14:22 +02:00
Denis Merigoux
dcf80f4bec
Adding first_day_of_month and last_day_of_month
2022-07-21 14:14:04 +02:00
Denis Merigoux
58cb48fb28
Merge remote-tracking branch 'origin/master' into aides_logement
2022-07-20 11:20:00 +02:00
Denis Merigoux
be373f0ff5
Added primitives money_to_decimal and decimal_to_money [skip ci]
2022-07-19 11:53:09 +02:00
Louis Gesbert
513647cd32
AST simplification: remove redundant annotations
...
The AST structures track annotations (e.g., at the moment, source code
position information) in a lot of places. This patch tidies up a bit and
removes some duplication, ensuring a single level of annotation wrapping
at each AST recursion level.
This will be important when adding type information in these
annotations, because there will be consitency constraints to be ensured
and duplication is a likely source of mistakes.
2022-07-11 16:51:54 +02:00
Louis Gesbert
af0ac95682
Propagate renaming of Pos.mark*
into module Marked
...
this patch is just a bunch of `sed` commands
```shell
cd compiler
sed -i 's/Pos.marked/Marked.pos/g' *.ml* **/*.ml*
sed -i 's/Pos.unmark/Marked.unmark/g' *.ml* **/*.ml*
sed -i 's/Pos\.get_position/Marked.get_mark/g' *.ml* **/*.ml*
sed -i 's/Pos\.same_pos_as/Marked.same_mark_as/g' *.ml* **/*.ml*
sed -i 's/Pos\.map_under_mark/Marked.map_under_mark/g' *.ml* **/*.ml*
sed -i 's/Pos\.mark/Marked.mark/g' *.ml* **/*.ml*
sed -i 's/Pos\.compare_marked/Marked.compare/g' *.ml* **/*.ml*
```
2022-07-11 16:51:54 +02:00
Denis Merigoux
ab0f4eb28c
Merge branch 'master' into allocations_logement
2022-06-01 17:28:54 +02:00
Denis Merigoux
878de024b7
Better error message
2022-06-01 11:13:14 +02:00
Jonathan Protzenko
0e68c07567
Reset parser messages
2022-06-01 10:26:14 +02:00
kescher
db9eec3b9f
add support for duration multiplication
...
Signed-off-by: Jonathan Protzenko <protz@microsoft.com>
2022-05-31 11:17:38 -07:00
Denis Merigoux
166355fad0
Merge pull request #260 from AltGr/parser-tweaks
...
An attempt to fix some parser priorities
2022-05-18 14:45:02 +01:00
Louis Gesbert
faa5b32638
Merge remote-tracking branch 'origin/master' into allocations_logement
2022-05-12 15:22:17 +02:00
Louis Gesbert
f9fc1a8e8b
Formatting: sync with master
2022-05-12 15:10:55 +02:00
Louis Gesbert
546347bbe2
Parser: allow chained if/then/else if/then/etc.
2022-05-11 19:26:34 +02:00
Louis Gesbert
05e3205fc9
Parser: priority tweaks
...
- makes sums and mults left-associative instead of right-associative (see the
change in the tests!)
- uses higher priority for unary operators
2022-05-11 19:26:34 +02:00
Louis Gesbert
f17875f90e
Formatting: some other personal preferences
2022-05-11 16:25:49 +02:00
Louis Gesbert
74c5629153
Formatting: reduce extra match-case indentation
...
2 is plenty enough, esp. for nested matches :)
2022-05-11 16:25:20 +02:00
Louis Gesbert
fa3693d813
Formatting: disable deprecated "smart" fun-decl option
2022-05-11 16:22:56 +02:00
Louis Gesbert
6cb0d581a6
Workaround some ocamlformat crashes
...
These files were not reformatted!
2022-05-11 16:21:07 +02:00
Denis Merigoux
96f1845afd
Merge branch 'master' into allocations_logement
2022-05-08 15:20:04 +02:00
Denis Merigoux
a52cc0d881
Move fix to lexer as suggested by @altgr
2022-05-06 10:29:39 +02:00
Denis Merigoux
080e60c25d
Fixes money cents parsing
2022-05-05 16:50:33 +02:00
Denis Merigoux
a72944a3ec
Merge branch 'master' into allocations_logement
2022-05-05 14:27:48 +02:00
Denis Merigoux
c7b84ca2d0
Merge pull request #244 from CatalaLang/c_backend
...
Bringing structure to the Lcalc AST
2022-05-05 14:22:26 +02:00
Denis Merigoux
2254527598
Corrige problème lexing arrondi en français
2022-04-29 21:41:52 +02:00
Denis Merigoux
d08dfb17d2
Corrige problème lexing arrondi en français
2022-04-29 21:41:20 +02:00
Denis Merigoux
aaa6a5d3a6
Merge branch 'master' into allocations_logement
2022-04-29 21:29:07 +02:00
Denis Merigoux
78e8275d5e
Adds a decimal rounding operator
2022-04-29 21:18:15 +02:00
Denis Merigoux
1bf4404bb3
Big refactoring of the APL code
2022-04-29 20:18:01 +02:00
Denis Merigoux
3ded0c7399
Better error messages
2022-04-25 15:28:16 +02:00
Denis Merigoux
dca6a6c3d4
Merge branch 'master' into allocations_logement
2022-04-22 15:20:48 +02:00
Denis Merigoux
1c86c8298b
Fix decimal parsing
2022-04-22 14:26:28 +02:00
Denis Merigoux
d889397425
Write first computation test with @Lilyaslm!
2022-04-21 17:20:40 +02:00
Denis Merigoux
4cd6d5519d
Fix doc generation
2022-04-14 11:18:26 +02:00
Denis Merigoux
6e03b512d9
Merge branch 'master' into allocations_logement
2022-04-13 15:28:54 +02:00
Denis Merigoux
ce7e756af1
Nice error messages for empty structs and enums
2022-03-28 14:43:38 +02:00
Denis Merigoux
7872e8dac3
Typo in lexer
2022-03-17 13:23:07 +01:00
Denis Merigoux
bb33d05c4a
Typo in lexer
2022-03-17 13:22:07 +01:00
Denis Merigoux
8f68e2b262
Merge branch 'master' into allocations_logement
2022-03-17 13:15:24 +01:00
Denis Merigoux
cdac6de9fe
Implement the round money builtin
2022-03-17 12:30:14 +01:00
Denis Merigoux
c936e7b6ed
Reshuffle code, make it work, correct a few yes/no inversion bugs
2022-03-15 19:47:41 +01:00
Denis Merigoux
5bd66142a6
Big reformatting
...
ocamlformat 0.19.0 -> 0.20.1
100 -> 80 columns per line
Reestablished @emilerolley's smart fun break
2022-03-08 15:03:14 +01:00
Louis Gesbert
12ec65601d
Use format strings directly in debug/error/log functions
...
This avoids many intermediate calls to e.g. `Format.asprintf`; should result in
some cases in "more correct" use of `Format`¹, avoid the computation of unused
debug strings, and make the code more readable.
¹ for `Format` to work as expected, all intermediate calls need to go through
it. Some cases of formatting to an intermediate string then printing through Format
again are still present, but this makes the situation better.
2022-03-08 13:04:27 +01:00
Denis Merigoux
23766e34a9
More negative tests
2022-03-07 11:55:26 +01:00
Denis Merigoux
8167d7ee00
Simple tests
2022-03-06 17:13:40 +01:00
Denis Merigoux
5ef7e45e11
Desugared to scope complete but untested [skip ci]
2022-03-06 14:15:09 +01:00
Denis Merigoux
171e8932bc
Desugaring implemented [skip ci]
2022-02-28 18:34:32 +01:00
Denis Merigoux
518ff02696
Added desugared AST, necessary to distinguish Desugared.ScopeVar from Scopelang.ScopeVar [skip ci]
2022-02-28 17:19:39 +01:00
Denis Merigoux
1e11f6c1d5
Name resolution
2022-02-28 15:40:19 +01:00
Denis Merigoux
eb7f00f56d
Syntax: parser and highlighting
2022-02-28 14:33:07 +01:00
Denis Merigoux
2263dd7dab
Update syntax highlighting and test suite [skip ci]
2022-02-07 12:04:48 +01:00
Denis Merigoux
e3b5d2d0b6
Finer control over input IO (distinction only_input/reentrant) [skip ci]
2022-02-07 10:30:36 +01:00
Denis Merigoux
6601585b77
First test passing, awaiting rest of features
...
(subscopes, etc.)
2022-02-05 00:04:19 +01:00
Denis Merigoux
5962b23f93
Restore CI
2022-02-04 15:45:27 +01:00
Denis Merigoux
11d4a34783
Better printing, tests, fix parser ommission
2022-02-04 15:10:47 +01:00
Denis Merigoux
13b476d0a1
[skip ci] reorganized desugared to scope encoding, broke some invariants
...
WIP: fixed some bugs and provided documentations but one thing missing
2022-01-28 17:31:31 +01:00
Denis Merigoux
0a9e6db5f4
Fix UTF8 lexing.
...
By what magic did it work until now?
2022-01-28 11:09:44 +01:00
Denis Merigoux
05a0bfc9b7
Added parsing support for #112 , missing all later compilation steps
2022-01-27 18:03:47 +01:00
Denis Merigoux
d2977b48ce
Documentation pass
2022-01-19 10:54:16 +01:00
Denis Merigoux
f8dc1494f0
Autoformatting
2022-01-10 18:36:14 +01:00
Louis Gesbert
8d059b420e
Fix console formatting with colors
...
closes #174
2022-01-10 15:56:55 +01:00
Denis Merigoux
909e539cdc
Fixed all bugs
2022-01-05 15:57:18 +01:00
Denis Merigoux
82c09ee455
Fixed a bug [skip ci]
2022-01-05 15:37:34 +01:00
Denis Merigoux
9733f39653
Refactoring done except Desugared_to_scope.def_map_to_tree [skip ci]
2022-01-05 09:14:43 +01:00
Denis Merigoux
f6825668dd
Propagate labels in desugaring, not building desugared/ yet [skip-ci]
2022-01-04 18:19:15 +01:00
Denis Merigoux
e9d54e120d
Changed label scoping from scope to scope definition key [skip ci]
2022-01-03 18:39:59 +01:00
Emile Rolley
397b0e1d7c
fix(build/doc): remove warnings due to .ml* files
2022-01-02 14:53:51 +01:00
Denis Merigoux
4137641c8c
Better error message
2021-11-28 13:16:21 +01:00
Denis Merigoux
d1b75b047b
Give a name to every rule and def, label or not
2021-11-28 13:09:44 +01:00
Denis Merigoux
5619113ac4
Remove code duplication
2021-11-28 12:46:49 +01:00
Denis Merigoux
166baf42af
Error when duplicate labels
2021-11-28 12:28:30 +01:00
Denis Merigoux
a06cbe8614
Fix literate programming problems
2021-11-26 18:07:46 +01:00
Denis Merigoux
8c0694ba15
Fixes #101
2021-11-12 09:43:23 +01:00
Denis Merigoux
22cd03c466
Bumping version numbers and fixing 0.5.0 build
2021-11-07 11:00:46 +01:00
Denis Merigoux
1d0ef3cf70
Better error message and correctly format desugaring.ml
2021-11-06 23:16:58 +01:00
Denis Merigoux
56baf91923
Remove prefixes to each line in messages, keep only first line
2021-11-06 23:04:12 +01:00
Emile Rolley
9aaa614410
refactor(parser): add the new catala-metadata markup
2021-10-01 10:01:25 +02:00
Denis Merigoux
b72d8e09ee
Restore typechecking version of CGI example
2021-09-28 12:01:08 +02:00
Louis Gesbert
dc026d0a7f
I was still unhappy with the remaining duplication
...
that and the double-matching with different kinds of regexps; it should be more
robust now.
2021-08-20 14:23:10 +02:00
Louis Gesbert
dfb358993c
Small fix
2021-08-19 20:41:34 +02:00
Louis Gesbert
98aed4187a
Further factorise decimals parsing
2021-08-19 20:32:23 +02:00
Louis Gesbert
e431e194de
Factorise lexer translations
2021-08-19 18:26:06 +02:00
Denis Merigoux
7cbb4a9149
Merge pull request #138 from AltGr/lexer-refactor
...
Cleanup the lexer, and refactor for more generic directives
2021-08-19 12:12:53 +02:00
Denis Merigoux
b56299f3d3
Switch ocamlformat to 0.19.0
2021-08-19 11:35:56 +02:00
Louis Gesbert
fdcdefd4d0
Fix parser conflict
...
`LAW_TEXT` tokens are now returned one per line, so we need an associativity
rule to correctly aggregate them.
2021-08-19 11:25:32 +02:00
Louis Gesbert
9cb3a405d8
Fix lexing of money tokens
...
- The polish lexer was wrongly adapted from the american one: the code to trim
the prefix `$` char was kept instead of trimming the postfix `PLN`
- Anyway the regex isn't enforced to match until the end of input so trimming
postfix units is not needed
- And the trimming for `€` was wrong anyway, it assumed `€` is only 1 char long
in utf8
2021-08-19 11:25:32 +02:00
Louis Gesbert
3b5c4c17cd
Resync the three lexers
...
We'll need to factorise that better in the not-too-far future: there was already
a discrepancy between en and fr; and this won't scale if we keep adding
languages.
2021-08-19 11:25:32 +02:00
Louis Gesbert
b31bee71ad
Cleanup the lexer, and refactor for more generic directives
2021-08-18 18:23:08 +02:00
EmileRolley
6169d19b1e
feat(compiler): add collection concatenation operator
2021-07-08 16:27:46 +02:00
Denis Merigoux
bbd50747d9
Big renaming and dir reorg
2021-06-21 11:39:06 +02:00