Catala: a DSL for turning legislative texts into reviewable code
Programming language for literate programming law specification
At a glance
- What is it?
- Catala is an OCaml-implemented domain-specific language for literate legislative programming, where each article of law is annotated and compiled into an implementation that lawyers can read and certify. It is not a general-purpose language, and the README calls it a research project.
- Who is it for?
- Adopt Catala if your problem is socio-fiscal rules whose fidelity to a written legal text must be reviewable by lawyers, and you are willing to work in OCaml tooling. Do not adopt it as a general-purpose language or as a shortcut around legal review; the README itself files Catala under limitations and disclaimer as a research project.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository received new commits within the last day.
- What is it written in?
- Mainly OCaml, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 23, 2026, and from our analysis. They are not legal advice.
Star history
- CatalaLang/catala2,452 ★ · +51
| Repository | 2026-09-30 | 2026-11-23 |
|---|---|---|
| CatalaLang/catala | 2.4k | 2.5k |
51 Stars in the last 54 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The gap Catala targets: law that has to be executable and auditable at once
Socio-fiscal rules are written in prose by legislators and re-expressed in code by engineers. Every re-expression is a chance to drift from the text, and the drift is invisible because the two artifacts live in different repositories, different review processes and different vocabularies. Catala attacks that gap by making the legal text itself the source file. The README describes the workflow plainly: gather the laws, executive orders and previous cases that bear on the mechanism, then annotate the text article by article in a text editor. The annotation is the program. The compiler then produces a lawyer-readable PDF version of the implementation, so the people who certify the rule are reading a rendering of the code they are certifying, not a summary of it. The audience is narrow on purpose: teams implementing tax and benefit calculations, and the lawyers who have to sign off on those calculations.
Definition-under-conditions and default logic as first-class language features
The mechanism that separates Catala from a conventional rules engine is default logic. Legal texts routinely state a general rule and then carve out exceptions, and later carve exceptions out of the exceptions. In ordinary code this becomes nested conditionals, and the nesting order silently encodes a priority that no one wrote down. Catala instead builds on what the README calls definition-under-conditions, a structure the project attributes to Professor Sarah Lawsky's article A Logic for Statutes. The README states that Catala is the only programming language known to the project that embeds default logic as a first-class feature, which is the claim behind its fit for literate legislative programming. That design choice is the whole product. It also explains the toolchain shape: a compiler, a proof-oriented opam package, a VSCode extension bundling an LSP server for navigation and completion, and a separate catala-format tool built on a tree-sitter grammar.
Installing the Catala compiler with opam and compiling a first file
The README points to the Catala book for installation instructions, so treat the book as authoritative rather than the repository README. The publisher is opam, and the Makefile in the repository shows the dependency route the project uses internally: pin the package, then install with documentation and test dependencies.
opam pin . --no-action
OPAMVAR_cataladevmode=1 opam install ./catala.opam --with-doc --with-test --deps-onlyThe OPAMVAR_cataladevmode variable is what selects the development tool set, and the Dockerfile sets the same variable before creating a switch. The Makefile also warns when groff, python3, node, npm, ninja and pandoc are missing, so expect those on the path if you intend to run the full build rather than just the compiler.
For editor support, the README names the VSCode extension on the marketplace, which bundles syntax highlighting and an LSP server. Formatting comes from catala-format, and the README notes that if it is installed, formatting is available directly in VSCode.
Compiler API documentation is generated from the source with dune and odoc. The README gives this command and says to open doc/odoc.html afterwards.
make docA first real use is not a hello world. It is taking one article of a socio-fiscal text, annotating it, and checking that the compiler accepts your reading of the conditions. The README directs newcomers to the official tutorial at book.catala-lang.org before anything else.
Where Catala is the wrong tool
Catala is a domain-specific language, and the README is explicit that it is adapted for socio-fiscal legislative literate programming. If your rules were not written down as law, default logic buys you nothing and you are paying for an OCaml toolchain to get ordinary conditionals. The README also carries a Limitations and disclaimer section, and it opens by calling Catala a research project. That is the honest framing, and it should shape procurement. A research compiler is not a runtime you drop into a production pipeline on the strength of a version number; the release list shows a nightly build alongside tagged versions 1.2.1 and 1.2.0, which tells you the project ships continuously and expects users to track change. Toolchain friction is the second limitation. The build depends on an opam switch, and the Makefile's dependency warnings name groff, python3, node, npm, ninja and pandoc. Teams without OCaml experience should budget for that before they budget for the law. Finally, the README does not document rollback or migration between compiler versions, so version pinning discipline is on you.
Catala compared with encoding statutes in a general-purpose language
The obvious alternative is to write the same calculation in Python, Java or a rules engine such as Drools, and keep the legal text in a document beside it. The difference is not syntax, it is where the priority order lives. In a general-purpose language, the exception structure is expressed by control flow, and the reviewer has to reconstruct the statute's priority from the code's nesting. Catala makes the priority part of the language, so the compiler is the thing that resolves it, and the output can be rendered back into prose for a lawyer. The trade is real: you give up the libraries, hiring pool and deployment story of a mainstream language, and you gain a review artifact that maps onto the statute. Note that the Catala repository is not the only place the work lives. The README points to a separate french-law repository for the generated code and its API, and to a separate catala-examples repository for programs. If your jurisdiction is not covered there, you are writing the annotations yourself. The syntax cheat sheet exists in French and English versions according to the README, which hints at where the annotation effort has concentrated.
Maintenance, licensing and the cost of tracking the compiler
The last push to the repository was on 2026-09-28, and the most recent tagged release before that was 1.2.1 on 2026-07-06, following 1.2.0 on 2026-06-02. A nightly build was published on 2026-08-22. That cadence means upgrades are a recurring cost rather than an annual event, and the changelog at CHANGELOG.md is the file to read before bumping. The compiler and the code in the repository are released under Apache-2.0, with the README noting that sub-directories may carry a different license where explicitly stated, so a dependency audit should check per-directory license files rather than assuming the top-level LICENSE.txt covers everything. Apache-2.0 is permissive and includes a patent grant, but this is a description of the license text, not legal advice; if you redistribute generated code or embed the compiler, have counsel read the sub-directory terms. The opam ecosystem pins versions through catala.opam.locked, which is the mechanism the project itself uses to keep builds reproducible.
Editorial conclusion
Adopt Catala if your problem is socio-fiscal rules whose fidelity to a written legal text must be reviewable by lawyers, and you are willing to work in OCaml tooling. Do not adopt it as a general-purpose language or as a shortcut around legal review; the README itself files Catala under limitations and disclaimer as a research project. Before committing, verify the default-logic semantics against the formalization README in doc/formalization, and confirm the target language runtime you need is among those covered by the French law library readme.
Frequently asked questions
What is Catala and what does it do?
Catala is a domain-specific language for deriving faithful-by-construction algorithms from legislative texts, according to the README. You annotate a legal text article by article, and the compiler produces an implementation plus a lawyer-readable PDF version of it.
Is Catala a general-purpose programming language?
No. The README describes it as a language adapted for socio-fiscal legislative literate programming, and its core feature is definition-under-conditions built on default logic. It is meant for encoding rules that originate in written law.
How do I install the Catala compiler?
The README directs readers to the Catala book at book.catala-lang.org for installation instructions, and the package is published on opam. The repository Makefile shows the project pinning the package and installing catala.opam with documentation and test dependencies.
What licence is Catala released under?
The compiler and the code in the repository are released under the Apache license version 2, per the README, unless another license is stated for a sub-directory. Check per-directory license files before redistributing.
Is Catala production-ready?
The README places Catala under a Limitations and disclaimer section and calls it a research project. The project also publishes a nightly build alongside tagged releases, so users are expected to track a moving compiler.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/catalalang-catala)Star history chart for your README
[](https://hysenlabs.com/projects/catalalang-catala)Was this useful?