I just remembered a unique aspect of the French tax system vis-à-vis our ancient IRS computers.

In France, the tax code is programmed in a custom domain-specific language which people have written a new compiler for called Mlang:

https://arxiv.org/abs/2011.07966

Related to this, a team of French computer scientists created a new programming language called Catala for the purpose of coding tax law.

https://news.law.northwestern.edu/sarah-lawsky-worked-on-a-tax-law-code-that-the-french-government-deemed-officially-awesome/

#taxes #France #IRS #Mlang #Catala

A Modern Compiler for the French Tax Code

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.org

Couple things: automatic sorting of arrays using self-balancing trees, O(log(n)) lookup times for pretty much anything (sometimes O(1))

Downside is it's weird: data is basically encoded in the dimensions of the array

#Programming #MLang #CLang #Coding #Technology

If you get the chance today, look up the programming language "M" aka MUMPS

It will really make you appreciate the new-fangled tech available in C...like...functional programming
#FunctionalProgramming #MLang #CLang #Programming

Another great article from Ben Gribaudo on #PowerQuery and #MLang , this time exploring the nuance of the global environment in a custom connector. If you want to understand M better, his series is essential reading.

https://bengribaudo.com/blog/2022/12/23/7130/power-query-m-primer-part25-extending-the-global-environment

#PowerBI

Power Query M Primer (Part 25): Extending the Global Environment | Ben Gribaudo

Fun calendar request from a client: week numbers for Friday-Thursday weeks.

1. Start withThursdays only (week-ends)
2. Group by year
3. Add index column to per-year grouped table
4. Ungroup
5. Backfill all dates

The important insight is not to start with all dates and try to figure out where they belong, but to start only with the concept of weeks and add the rest of the dates in a later step after numbering the weeks.

Code: https://paste.sr.ht/~greggyb/86c53d6a01d0dd15508945a383c999ec9d96c9d2

#PowerQuery #PowerBI #MLang #etl

ArbitraryWeekCalendar.m — paste.sr.ht

1/ Mise en production de #Mlang, le compilateur développé par @DMerigoux
et Raphael Monat, pour le langage dédié conçu par la DGFiP pour faciliter le calcul de l'Impôt sur le Revenu 3/5