Tutorial : computing your taxes

Welcome to this tutorial, whose objective is to guide you through the features of the Catala language and teach you how to annotate a simple legislative text using the language, and get out an executable program that compute your taxes!

This tutorial does not cover the installation of Catala. For more information about this, please refer to the installation section. If you want follow this tutorial locally, read the section about creating your first program and simply copy-paste the code snippets of the tutorial into your Catala program file.

Need more information?

At any point, please refer to the Catala syntax cheat sheet or the reference guide for an exhaustive view of the syntax and features of Catala; this tutorial is rather designed to ease you into the language and its common use patterns.

There are three sections in the tutorial, that are designed to be complete in order as they cover increasingly difficult and advanced features of the language:

  • the first section is about the basic blocks of the language programs with simple data flow;
  • the second section is about what makes Catala unique: its first-class handling of conditional definitions and exceptions;
  • the third section is about scaling up the codebase with multiple functions and lists of items.

Practising the tutorial

This tutorial is designed to be an interactive experience. While reading the text of the different sections, we encourage you to create a tutorial.catala_en empty text file and fill it by copy-pasting the code snippets presented. Through this companion file, you will be able to see first-hand how the Catala typechecker and interpreter behaves on the different examples, and even make your own experiences by tweaking the code yourself.

You should be all set to begin now. Godspeed!