There's whole language for law formalization called Catala.
and https://github.com/CatalaLang/catala-examples
French government seems to actually use it in one of their web services, see https://docs.aides.beta.gouv.fr/03_mutualiser/02_outils.html (page in French)