Commit Graph

63 Commits

Author SHA1 Message Date
Denis Merigoux
e80143b3ca
Last linting pass and update tests 2023-03-31 17:56:45 +02:00
Louis Gesbert
3766e9db2c Fix function argument naming consistency in the examples 2023-02-28 16:17:19 +01:00
Louis Gesbert
d3ccfe9b91 Adjust examples for the new function declaration syntax 2023-02-28 15:53:50 +01:00
JusBanuls
6d05b2148e Retour à la ligne avec Alain 2023-01-12 17:14:35 +01:00
Louis Gesbert
2003566867 Force parens in compound logic formulas
Closes #373

This forbids expressions such as `a and b or c`, avoiding the need to set an
implicit priority between `and`, `or` and `xor`, which I find error-prone.

Instead, when that appears, a message asking for explicit parentheses will be
shown to the user.

Implementation note: since that would be extremely tedious to do in the parser
directly, the parser is set to allow right-associativity without discrimination
for the logical operators, and the check is done during desugaring. This
required to explicit parentheses in the surface AST to discriminate the case
where the priority was explicit.
2023-01-04 10:46:14 +01:00
Louis Gesbert
47502335aa Refactor the parser to use priorities
Define a single expression rule with disambiguation using token priorities
instead of the many layers of intermediate rules with explicit sub-terms.

Also replaces `in` for collection operations (`x+1 for foo in [1;2]`) with
`among` which helps a lot.
2022-12-19 15:12:53 +01:00
Louis Gesbert
dcb422302d Tests/examples update 2022-12-13 12:30:40 +01:00
Louis Gesbert
71bb67163c Remove explicitely typed operators in tests and examples
Command used: `sed -i 's/\([-+*/><=]=\?\)[.$@^€$]/\1/g' **/*/*.catala_*`

The overload test, of course, is kept unchanged and ensures that explicit
operators still work.
2022-12-13 12:00:04 +01:00
Louis Gesbert
4ee4a96ac7 Remove *all* struct field access qualifiers in catala code
They are no longer needed \o/
2022-11-28 16:42:02 +01:00
Louis Gesbert
b19a7660fc Fix ambiguities in examples 2022-10-21 17:36:44 +02:00
Louis Gesbert
0ab7a0f9ce Turn all existing tests to inline tests
Done using
```bash
process() { FILE=$1; awk 'match($0, /^```catala-test *{ *id *= *"(.*)" *}/, a) {print "```catala-test-inline"; f="'"$(dirname $FILE)/output/$(basename $FILE)"'." a[1]; getline; print "$ " $0; while ((getline<f) > 0) print; next} {print}' $FILE >$FILE.new; mv $FILE.new $FILE; }
for f in tests/test_*/*/*.catala_* examples/**/*.catala_*; do process $f; git add $f; done
for d in $(find -name output -type d); do git rm -r $d; done
```
2022-09-23 14:45:10 +02:00
Denis Merigoux
1c3d5b9a75
Fix all lines too long problems & update assets 2022-08-29 15:46:06 +02:00
Louis Gesbert
1d268a940b Add tests for the examples as well 2022-07-08 17:18:58 +02:00
Denis Merigoux
8f1dae73a2
Restore CI 2022-05-05 14:06:56 +02:00
Denis Merigoux
a8733e6a61
Fix tests [skip ci] 2022-02-09 15:56:57 +01:00
Denis Merigoux
1c4a0bdd5d
Updated all examples with input/output decorations [skip ci] 2022-02-07 18:18:23 +01:00
Denis Merigoux
5962b23f93
Restore CI 2022-02-04 15:45:27 +01:00
Denis Merigoux
a963a01f60
Unit tests for examples now use clerk 2022-01-11 10:42:12 +01:00
Emile Rolley
9aaa614410 refactor(parser): add the new catala-metadata markup 2021-10-01 10:01:25 +02:00
Denis Merigoux
f9b88e2259
Fixed heading precedence in examples 2021-05-15 16:04:35 +02:00
Denis Merigoux
3c8d187be0
Big refactoring of the literate programming structure
Partially fixes #120
Removes the distinction between headers and articles, streamlines the surface AST
Changes affects lexers and parser
2021-05-15 01:16:08 +02:00
EmileRolley
45b6736e84 fix(examples): fix inverted months and days 2021-03-16 12:46:03 +01:00
EmileRolley
55978cdbf6 refactor(examples): change the date format to ISO in the us_tax_code/section_1015 2021-03-16 12:24:32 +01:00
EmileRolley
28ff1b075b refactor: modify the parser and tests in order to support the ISO date format 2021-03-16 12:08:02 +01:00
EmileRolley
c0a9344eca refactor(tests): update tests based on the abbreviated english lexer 2021-03-09 22:07:31 +01:00
EmileRolley
a42d0c7728 refactor(tests): udpates tests based on the english lexer 2021-03-09 20:48:35 +01:00
Denis Merigoux
fb63c8afc8 Restore tests 2021-02-19 09:09:13 +01:00
Denis Merigoux
e9b134ab79 Progress on section121 after pair programming session 2021-02-18 18:18:34 +01:00
Denis Merigoux
252748968a Fix name 2021-02-15 21:45:11 +01:00
Denis Merigoux
494ba820b0 Continue Section121 2021-02-15 21:41:31 +01:00
Denis Merigoux
617d19df24 Improved OCaml backend, made dev loop 2021-01-28 18:30:01 +01:00
Aymeric Fromherz
78b4eb7ce1 Use unlabeled exceptions in US tax code 2021-01-21 23:49:43 -05:00
Denis Merigoux
19a6a171bd Fixes #65 2021-01-18 16:21:55 +01:00
Denis Merigoux
0f2937f37c Fixed date algorithm once and for all in Section121? 2021-01-16 17:23:02 +01:00
Denis Merigoux
d6426a57e5 Introduced error for experiment purposes 2021-01-15 10:42:09 +01:00
Denis Merigoux
852a6412eb Changed odate to calendarLib 2021-01-14 13:04:15 +01:00
Denis Merigoux
5a944a57a6 Pass old tests 2021-01-13 12:22:14 +01:00
Denis Merigoux
44d7b616a4 Improve type error messages 2021-01-13 12:04:14 +01:00
Denis Merigoux
983b347cd5 Results from the pair programming session 2021-01-12 18:02:28 +01:00
Denis Merigoux
b12768c78c Strengthen USTC 121 implementation 2021-01-11 15:19:05 +01:00
Denis Merigoux
113ca198e4 Update section121 code to make it correct 2021-01-05 16:00:42 +01:00
Denis Merigoux
4c760868b5 Fixed date algorithm 2021-01-05 14:58:44 +01:00
Denis Merigoux
f356712622 Reformat code 2021-01-05 14:48:13 +01:00
Denis Merigoux
7213f2850b Merge branch 'master' into pair_programming_section_121 2021-01-05 14:37:30 +01:00
Denis Merigoux
933fd02484
Merge pull request #45 from CatalaLang/dev
Ongoing Catala development
2021-01-04 14:54:11 +01:00
Denis Merigoux
0482acbd01 Fixed incorrect date 2021-01-03 18:52:41 +01:00
Denis Merigoux
5f58e93c6e Implemented all aggregate desugaring 2020-12-29 23:43:00 +01:00
Denis Merigoux
606b148c74 Lots of documentation 2020-12-21 16:02:00 +01:00
Denis Merigoux
1ddd46af55 Automatic unit test discovery, improved inclusion system 2020-12-11 21:17:01 +01:00
Denis Merigoux
4c219f81ff Automatic unit test detection but needs normal include 2020-12-11 15:24:10 +01:00