Skip to content

Instantly share code, notes, and snippets.

View denismerigoux's full-sized avatar

Denis Merigoux denismerigoux

View GitHub Profile
@denismerigoux
denismerigoux / impot_revenu.r
Created March 3, 2024 17:35
Calcul impôt revenu R généré par Catala
# This file has been generated by the Catala compiler, do not edit!
library(catalaRuntime)
# Enum cases: "Non" ("catala_unit"), "Oui" ("catala_money")
setClass(
"catala_enum_FraisReels",
representation(code = "character", value = "ANY")
)
@denismerigoux
denismerigoux / gist:ea26094d18caa412662896ab3b719dcd
Created February 15, 2022 16:59
Allocation familiales proof diff
[RESULT] [InterfaceAllocationsFamiliales.i_montant_versé] This variable never returns an empty error
[RESULT] [InterfaceAllocationsFamiliales.i_montant_versé] No two exceptions to ever overlap for this variable
[RESULT] [InterfaceAllocationsFamiliales.allocations_familiales.avait_enfant_à_charge_avant_1er_janvier_2012] No two exceptions to ever overlap for this variable
[RESULT] [InterfaceAllocationsFamiliales.allocations_familiales.enfants_à_charge] No two exceptions to ever overlap for this variable
[RESULT] [InterfaceAllocationsFamiliales.allocations_familiales.date_courante] No two exceptions to ever overlap for this variable
[RESULT] [InterfaceAllocationsFamiliales.allocations_familiales.résidence] No two exceptions to ever overlap for this variable
[RESULT] [InterfaceAllocationsFamiliales.allocations_familiales.ressources_ménage] No two exceptions to ever overlap for this variable
[RESULT] [InterfaceAllocationsFamiliales.allocations_familiales.personne_charge_effective_permanente_remplit_titre_I] No two
diff --git a/compiler/driver.ml b/compiler/driver.ml
index 2dac8dc..b315a19 100644
--- a/compiler/driver.ml
+++ b/compiler/driver.ml
@@ -175,8 +175,11 @@ let driver (source_file : Pos.input_file) (debug : bool) (unstyled : bool)
match output_file with
| Some f ->
let oc = open_out f in
- (Format.formatter_of_out_channel oc, fun _ -> close_out oc)
- | None -> (Format.std_formatter, fun _ -> ())
h6 class='law-heading'><a href='#'>Chapitre 2 : Champ d'application</a></h6>
<h7 class='law-heading'><a href='https://legifrance.gouv.fr/codes/id/LEGIARTI000038834523/2021-06-05'>Article L512-3</a></h7>
<p class='law-text'>Sous réserve des règles particulières à chaque prestation,
ouvre droit aux prestations familiales :<br/>
1°) tout enfant jusqu'à la fin de l'obligation scolaire ;</p>
<div class='code-wrapper'>
<div class='filename'>./securite_sociale_L.catala_fr</div>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>
<span class="normal"><a href="#./securite_sociale_L.catala_fr-48">48</a></span>
<span class="normal"><a href="#./securite_sociale_L.catala_fr-49">49</a></span>
type Enfant = {
identifiant: integer
obligation_scolaire: SituationObligationScolaire
rémuneration_mensuelle: money
date_de_naissance: date
âge: integer
prise_en_charge: PriseEnCharge
a_déjà_ouvert_droit_aux_allocations_familiales: bool
}
<head>
<style>
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.catala-code .hll { background-color: #ffffcc }
.catala-code { background: #ffffff; }
.catala-code .c { color: #888888 } /* Comment */
{
"items": [
[
{
"ArrayDecl": [
[
"State",
null
],
[
@denismerigoux
denismerigoux / allocations_familiales.js
Created February 1, 2021 19:17
Run the French family benefits computation in JS!
var Law = require("./french_law.js");
var Benchmark = require("benchmark");
var suite = new Benchmark.Suite();
suite
.add("AllocationFamiliales#benchmark", function () {
Law.computeAllocationsFamiliales({
currentDate: new Date("2020-05-20"),
children: [
{
@denismerigoux
denismerigoux / impots_revenus_2019.py
Last active October 11, 2020 10:29
Python implementation of the French income tax computation, generated by https://gitlab.inria.fr/verifisc/mlang
# -*- coding: utf-8 -*-
# File generated by the Mlang compiler
import yaml
from math import floor
class Singleton(type):
_instances = {}
/*
# First structure and signatures definitions
declaration structure Person
data name content string
data income content amount
date number_of_children content integer
declaration scope TaxCreditA :