HackerPapers

arXiv:2011.07966cs.PL

A Modern Compiler for the French Tax Code

Denis Merigoux, Raphaël Monat, Jonathan Protzenko

Abstract

In France, income tax is computed from taxpayers' individual returns, using an algorithm that is authored, designed and maintained by the French Public Finances Directorate (DGFiP). This algorithm relies on a legacy custom language and compiler originally designed in 1990, which unlike French wine, did not age well with time. Owing to the shortcomings of the input language and the technical limitations of the compiler, the algorithm is proving harder and harder to maintain, relying on ad-hoc behaviors and workarounds to implement the most recent changes in tax law. Competence loss and aging code also mean that the system does not benefit from any modern compiler techniques that would increase confidence in the implementation. We overhaul this infrastructure and present Mlang, an open-source compiler toolchain whose goal is to replace the existing infrastructure. Mlang is based on a reverse-engineered formalization of the DGFiP's system, and has been thoroughly validated against the private DGFiP test suite. As such, Mlang has a formal semantics; eliminates previous handwritten workarounds in C; compiles to modern languages (Python); and enables a variety of instrumentations, providing deep insights about the essence of French income tax computation. The DGFiP is now officially transitioning to Mlang for their production system.

arXiv comments
Journal reference
DOI
Subjects
cs.PLProgramming Languages

On Hacker News

Linked by 6 identifiable commenters in 8 comments across 7 threads, from Dec 2020 to May 2026. Found in 3 HN submissions from Nov 2020 to Jul 2024. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments7 threads

    • > [US] tax law drafting style follows default logic, a non-monotonic logic that is hard to encode in languages with first-order logic (FOL). https://arxiv.org/pdf/2011.07966.pdf Most law generally is non-monotonic. (See https://en.wikipedia.org/wiki/Non-monotonic_logic) The…

      wahernView on HNParent context

    • I briefly actually tried to read up on the laws that governed me, since I once heard "ignorance of the law is no excuse" and also was curious what, exactly, it would take to really, no kidding, translate the tax code into python or Mlang (https://arxiv.org/abs/2011.07966…

      mdanielView on HNParent context

    • France has an open source implementation of their tax code [0]. The paper [1] gives an overview of the implementation language, mlang. [0] https://github.com/MLanguage/mlang [1] https://arxiv.org/abs/2011.07966

      fsflyerView on HNParent context

  1. Open Source Tax Software 2 comments
    • AFAIU, the French Tax Code is effectively defined in terms of an algorithm. There was a recent HN thread (https://news.ycombinator.com/item?id=25208853) on a new open-source compiler for the tax code (https://arxiv.org/abs/2011.07966). The paper for the compiler references some…

      wahernView on HNParent context

    • The french initiative started in 2013 is still alive (last commit a few days ago), and passes the gov test suite (they keep in touch with our version of the IRS): https://github.com/openfisca/openfisca-france The way we got this is interestingly twisted. French citizens…

      BiteCode_devView on HNParent context

  2. Legalese – Computational Law 1 comment
    • Adding to this list: * https://catala-lang.org/ -- DSL for translating/annotating legal texts * https://arxiv.org/pdf/2011.07966.pdf -- A Modern Compiler for the French Tax Code * https://www.youtube.com/watch?v=EshxZVMURt4 -- Formal Methods and the Law

      paulvorobyevView on HNParent context

  3. Templating for Lawyers 1 comment
    • You might be interested in Merigoux et al 2021, "A Modern Compiler for the French Tax Code" [1]! [1]: https://arxiv.org/pdf/2011.07966.pdf

      benrbrayView on HNParent context

    • In general the law is absolutely not so rigorous. It's more like general philosophical literature in terms of logical rigor--diverse, disjoint, etc. But certain subdomains of the law can be closer to a formal system. The French tax code is peculiar (though I'm not sure its…

      wahernView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.