Rename to Catala!

This commit is contained in:
Denis Merigoux 2020-04-16 17:47:35 +02:00
parent 6c9d5c8c7e
commit a9a10f0e7f
25 changed files with 98 additions and 94 deletions

View File

@ -1,12 +1,16 @@
build: format
dune build
install:
dune build @install
format:
dune build @fmt --auto-promote | true
test: build
dune exec src/main.exe -- --debug --backend LaTeX --output \
test/allocations_familiales.tex test/allocations_familiales.lawspec
test/allocations_familiales.tex test/allocations_familiales.catala
inspect:
gitinspector -f ml,mli,mly,iro,tex,lawspec,md,ir --grading
gitinspector -f ml,mli,mly,iro,tex,catala,md,ir --grading

View File

@ -1,6 +1,6 @@
# Lawspec
# Catala
Lawspec is a domain-specific language for deriving faithful-by-construction algorithms
Catala is a domain-specific language for deriving faithful-by-construction algorithms
from legislative texts.
## Installation
@ -11,17 +11,17 @@ package, use the following command at the root of the repository:
opam install ./
You can then can the compiler using the `lawspec` command.
You can then can the compiler using the `catala` command.
## Usage
Use `lawspec --help` to get more information about the command line options available.
Use `catala --help` to get more information about the command line options available.
## Test
In the `test` folder, you will find the `allocations_familiales.lsp` file which contains the
algorithm computing French family benefits. The algorithm consists of annotations to the legislative
texts that define the family benetifs, using the literate programming paradigm. The `lawspec`
texts that define the family benetifs, using the literate programming paradigm. The `catala`
compiler can extract from the `.lsp` file a lawyer-readable version of the annotated text.
To get that lawyer-readable version (which is a LaTeX-created) PDF, use `make test` at the root of
the repository, and then use `make` inside ghe `test` directory to compile the LaTeX file.

View File

@ -3,14 +3,14 @@ opam-version: "2.0"
version: "0.1"
synopsis: "Low-level language for tax code specification"
description: """
The Lawspec language is designed to be a low-level target for
The Catala language is designed to be a low-level target for
higher-level specification languages for fiscal legislation.
"""
maintainer: ["denis.merigoux@inria.fr"]
authors: ["Denis Merigoux"]
license: "Apache2"
homepage: "https://gitlab.inria.fr/verifisc/lawspec"
bug-reports: "https://gitlab.inria.fr/verifisc/lawspec/issues"
homepage: "https://gitlab.inria.fr/verifisc/catala"
bug-reports: "https://gitlab.inria.fr/verifisc/catala/issues"
depends: [
"ocaml" {>= "4.07.0"}
"ANSITerminal" {>= "0.8.2"}
@ -35,4 +35,4 @@ build: [
"@doc" {with-doc}
]
]
dev-repo: "git+https://gitlab.inria.fr/verifisc/lawspec.git"
dev-repo: "git+https://gitlab.inria.fr/verifisc/catala.git"

View File

@ -1,20 +1,20 @@
(lang dune 2.1)
(name lawspec)
(name catala)
(version 0.1)
(generate_opam_files true)
(source (uri git+https://gitlab.inria.fr/verifisc/lawspec.git))
(homepage https://gitlab.inria.fr/verifisc/lawspec)
(bug_reports https://gitlab.inria.fr/verifisc/lawspec/issues)
(source (uri git+https://gitlab.inria.fr/verifisc/catala.git))
(homepage https://gitlab.inria.fr/verifisc/catala)
(bug_reports https://gitlab.inria.fr/verifisc/catala/issues)
(authors "Denis Merigoux")
(maintainers "denis.merigoux@inria.fr")
(license Apache2)
(package
(name lawspec)
(name catala)
(synopsis "Low-level language for tax code specification")
(description "\| The Lawspec language is designed to be a low-level target for
(description "\| The Catala language is designed to be a low-level target for
"\| higher-level specification languages for fiscal legislation.
)
(depends

View File

@ -1,4 +1,4 @@
(* This file is part of the Lawspec compiler, a specification language for tax and social benefits
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
<denis.merigoux@inria.fr>
@ -21,7 +21,7 @@ let debug_flag = ref false
open Cmdliner
let files =
Arg.(non_empty & pos_all file [] & info [] ~docv:"FILES" ~doc:"Lawspec files to be compiled")
Arg.(non_empty & pos_all file [] & info [] ~docv:"FILES" ~doc:"Catala files to be compiled")
let debug = Arg.(value & flag & info [ "debug"; "d" ] ~doc:"Prints debug information")
@ -40,11 +40,11 @@ let output =
"$(i, OUTPUT) is the file that will contain the extracted function (for compiler \
backends)")
let lawspec_t f = Term.(const f $ files $ debug $ backend $ output)
let catala_t f = Term.(const f $ files $ debug $ backend $ output)
let info =
let doc =
"Compiler for Lawspec, a specification language for tax and social benefits computation rules."
"Compiler for Catala, a specification language for tax and social benefits computation rules."
in
let man =
[
@ -60,16 +60,16 @@ let info =
`P "Denis Merigoux <denis.merigoux@inria.fr>";
`S Manpage.s_examples;
`P "Typical usage:";
`Pre "lawspec -b LaTeX file.lsp";
`Pre "catala -b LaTeX file.lsp";
`S Manpage.s_bugs;
`P "Please file bug reports at https://gitlab.inria.fr/verifisc/lawspec/issues";
`P "Please file bug reports at https://gitlab.inria.fr/verifisc/catala/issues";
]
in
let exits =
Term.default_exits
@ [ Term.exit_info ~doc:"on parsing error." 1; Term.exit_info ~doc:"on typechecking error." 2 ]
in
Term.info "lawspec"
Term.info "catala"
~version:
( match Build_info.V1.version () with
| None -> "n/a"

View File

@ -1,4 +1,4 @@
(* This file is part of the Lawspec compiler, a specification language for tax and social benefits
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
<denis.merigoux@inria.fr>
@ -55,4 +55,4 @@ let driver (source_files : string list) (debug : bool) (backend : string) (outpu
1
end
let main () = Cmdliner.Term.exit @@ Cmdliner.Term.eval (Cli.lawspec_t driver, Cli.info)
let main () = Cmdliner.Term.exit @@ Cmdliner.Term.eval (Cli.catala_t driver, Cli.info)

View File

@ -1,10 +1,10 @@
(include_subdirs unqualified)
(library
(public_name lawspec)
(public_name catala)
(libraries ANSITerminal sedlex menhirLib re cmdliner dune-build-info)
(preprocess
(pps sedlex.ppx)))
(documentation
(package lawspec))
(package catala))

View File

@ -1,4 +1,4 @@
(* This file is part of the Lawspec compiler, a specification language for tax and social benefits
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
<denis.merigoux@inria.fr>

View File

@ -1,4 +1,4 @@
(* This file is part of the Lawspec compiler, a specification language for tax and social benefits
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
<denis.merigoux@inria.fr>

View File

@ -1,4 +1,4 @@
(* This file is part of the Lawspec compiler, a specification language for tax and social benefits
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
<denis.merigoux@inria.fr>

View File

@ -1,4 +1,4 @@
(* This file is part of the Lawspec compiler, a specification language for tax and social benefits
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
<denis.merigoux@inria.fr>
@ -35,7 +35,7 @@ let source_file_item_to_latex (i : A.source_file_item) : string =
| A.LawText t -> pre_latexify t
| A.LawArticle a -> P.sprintf "\\paragraph{%s}" (pre_latexify a)
| A.CodeBlock (_, c) ->
P.sprintf "\\begin{minted}[firstnumber=%d]{lawspec}%s\\end{minted}"
P.sprintf "\\begin{minted}[firstnumber=%d]{catala}%s\\end{minted}"
(Pos.get_start_line (Pos.get_position c) + 1)
(Pos.unmark c)
| A.MetadataBlock (_, c) ->
@ -44,7 +44,7 @@ let source_file_item_to_latex (i : A.source_file_item) : string =
title=\\textcolor{black}{\\texttt{Métadonnées}},title after \
break=\\textcolor{black}{\\texttt{Métadonnées}},before skip=1em, after skip=1em]\n\
\\begin{minted}[frame=none,numbersep=9mm, framesep=0mm, \
firstnumber=%d]{lawspec}%s\\end{minted}\n\
firstnumber=%d]{catala}%s\\end{minted}\n\
\\end{tcolorbox}"
(Pos.get_start_line (Pos.get_position c) + 1)
(Pos.unmark c)

View File

@ -1,4 +1,4 @@
(* This file is part of the Lawspec compiler, a specification language for tax and social benefits
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
<denis.merigoux@inria.fr>

View File

@ -1,4 +1,4 @@
(* This file is part of the Lawspec compiler, a specification language for tax and social benefits
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
<denis.merigoux@inria.fr>

View File

@ -1,4 +1,4 @@
(* This file is part of the Lawspec compiler, a specification language for tax and social benefits
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
<denis.merigoux@inria.fr>

View File

@ -1,5 +1,5 @@
(*
This file is part of the Lawspec compiler, a specification language for tax and social benefits
This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules.
Copyright (C) 2020 Inria, contributor: Denis Merigoux <denis.merigoux@inria.fr>

View File

@ -1,4 +1,4 @@
(* This file is part of the Lawspec compiler, a specification language for tax and social benefits
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
<denis.merigoux@inria.fr>

View File

@ -1,4 +1,4 @@
(* This file is part of the Lawspec compiler, a specification language for tax and social benefits
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
<denis.merigoux@inria.fr>

View File

@ -1,7 +1,7 @@
(executable
(name main)
(package lawspec)
(public_name lawspec)
(libraries lawspec)
(package catala)
(public_name catala)
(libraries catala)
(preprocess
(pps sedlex.ppx)))

View File

@ -1,4 +1,4 @@
(* This file is part of the Lawspec compiler, a specification language for tax and social benefits
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
<denis.merigoux@inria.fr>
@ -12,4 +12,4 @@
or implied. See the License for the specific language governing permissions and limitations under
the License. *)
let _ = Lawspec.Driver.main ()
let _ = Catala.Driver.main ()

View File

@ -1,15 +1,15 @@
'scopeName': 'source.lawspec'
'name': 'Lawspec'
'scopeName': 'source.catala'
'name': 'Catala'
'fileTypes' : [
'lawspec'
'catala'
]
'name' : 'lawspec'
'name' : 'catala'
'patterns' : [
{
'include' : '#main'
}
]
'scopeName' : 'source.lawspec'
'scopeName' : 'source.catala'
'uuid' : ''
'repository' : {
'main' : {
@ -18,7 +18,7 @@
'begin' : '(@@)'
'beginCaptures' : {
'1' : {
'name' : 'markup.heading.title.lawspec'
'name' : 'markup.heading.title.catala'
}
}
'patterns' : [
@ -29,7 +29,7 @@
'end' : '(@@[\\+]*)'
'endCaptures' : {
'1' : {
'name' : 'markup.heading.title.lawspec'
'name' : 'markup.heading.title.catala'
}
}
}
@ -37,7 +37,7 @@
'begin' : '(@)'
'beginCaptures' : {
'1' : {
'name' : 'markup.heading.subtitle.lawspec'
'name' : 'markup.heading.subtitle.catala'
}
}
'patterns' : [
@ -48,19 +48,19 @@
'end' : '(@)'
'endCaptures' : {
'1' : {
'name' : 'markup.heading.subtitle.lawspec'
'name' : 'markup.heading.subtitle.catala'
}
}
}
{
'match' : '([^\\/])'
'name' : 'entity.law.lawspec'
'name' : 'entity.law.catala'
}
{
'begin' : '(\\/\\*)'
'beginCaptures' : {
'1' : {
'name' : 'comment.block.documentation.lawspec'
'name' : 'comment.block.documentation.catala'
}
}
'patterns' : [
@ -71,7 +71,7 @@
'end' : '(\\*\\/)'
'endCaptures' : {
'1' : {
'name' : 'comment.block.documentation.lawspec'
'name' : 'comment.block.documentation.catala'
}
}
}
@ -81,19 +81,19 @@
'patterns' : [
{
'match' : '(\\s*\\#.*$)'
'name' : 'comment.line.lawspec'
'name' : 'comment.line.catala'
}
{
'match' : '(contexte)(\\s+)([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)'
'captures' : {
'1' : {
'name' : 'keyword.other.lawspec'
'name' : 'keyword.other.catala'
}
'2' : {
'name' : 'text.lawspec'
'name' : 'text.catala'
}
'3' : {
'name' : 'entity.name.function.lawspec'
'name' : 'entity.name.function.catala'
}
}
}
@ -101,59 +101,59 @@
'match' : '(donnée|condition)(\\s+)([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)'
'captures' : {
'1' : {
'name' : 'keyword.other.lawspec'
'name' : 'keyword.other.catala'
}
'2' : {
'name' : 'text.lawspec'
'name' : 'text.catala'
}
'3' : {
'name' : 'meta.variable_id.lawspec'
'name' : 'meta.variable_id.catala'
}
}
}
{
'match' : '\\b(selon|sous\\s+forme|fixé\\s+par|décroissante|croissante|varie\\s+avec|on\\s+a|dans|tel\\s+que|existe|pour|tout|de|si|alors|sinon)\\b'
'name' : 'keyword.control.lawspec'
'name' : 'keyword.control.catala'
}
{
'match' : '\\b(champ\\s+d\'application|si\\s+et\\s+seulement\\s+si|dépend\\s+de|déclaration|inclus|collection|contenu|optionnel|structure|énumération|contexte|règle|sous condition|conséquence|rempli|égal\\s+à|assertion|définition)\\b'
'name' : 'keyword.other.lawspec'
'name' : 'keyword.other.catala'
}
{
'match' : '(\\|[0-9]+/[0-9]+/[0-9]+\\|)'
'name' : 'constant.numeric.lawspec'
'name' : 'constant.numeric.catala'
}
{
'match' : '\\b(vrai|faux)\\b'
'name' : 'constant.lawspec'
'name' : 'constant.catala'
}
{
'match' : '\\b([0-9]+(\\.[0.9]*|))\\b'
'name' : 'constant.numeric.lawspec'
'name' : 'constant.numeric.catala'
}
{
'match' : '(\\-\\-|\\;|\\.|\\,|\\:|\\(|\\))'
'name' : 'punctuation.lawspec'
'name' : 'punctuation.catala'
}
{
'match' : '(\\-\\>|\\+|\\-|\\*|/|\\!|non|ou|et|=|>|<|\\x{20ac}|%|an|mois|jour)'
'name' : 'keyword.operator.lawspec'
'name' : 'keyword.operator.catala'
}
{
'match' : '\\b(entier|booléen|date|montant|décimal|décret|loi|nombre|somme|date_aujourd_hui)\\b'
'name' : 'support.type.lawspec'
'name' : 'support.type.catala'
}
{
'match' : '\\b([A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)(\\.)([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)\\b'
'captures' : {
'1' : {
'name' : 'entity.name.class.lawspec'
'name' : 'entity.name.class.catala'
}
'2' : {
'name' : 'punctuation.lawspec'
'name' : 'punctuation.catala'
}
'3' : {
'name' : 'entity.name.function.lawspec'
'name' : 'entity.name.function.catala'
}
}
}
@ -161,23 +161,23 @@
'match' : '\\b([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)(\\.)([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\'\\.]*)\\b'
'captures' : {
'1' : {
'name' : 'entity.name.function.lawspec'
'name' : 'entity.name.function.catala'
}
'2' : {
'name' : 'punctuation.lawspec'
'name' : 'punctuation.catala'
}
'3' : {
'name' : 'meta.variable_id.lawspec'
'name' : 'meta.variable_id.catala'
}
}
}
{
'match' : '\\b([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)\\b'
'name' : 'entity.name.function.lawspec'
'name' : 'entity.name.function.catala'
}
{
'match' : '\\b([A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)\\b'
'name' : 'entity.name.class.lawspec'
'name' : 'entity.name.class.catala'
}
]
}
@ -185,7 +185,7 @@
'patterns' : [
{
'match' : '(.)'
'name' : 'markup.heading.title.lawspec'
'name' : 'markup.heading.title.catala'
}
]
}
@ -193,7 +193,7 @@
'patterns' : [
{
'match' : '(.)'
'name' : 'markup.heading.subtitle.lawspec'
'name' : 'markup.heading.subtitle.catala'
}
]
}

View File

@ -1,16 +1,16 @@
{
"name": "language-lawspec",
"name": "language-catala",
"version": "1.0.0",
"description": "Syntax highlighting for the Lawspec",
"description": "Syntax highlighting for the Catala",
"engines": {
"atom": "*"
},
"repository": {
"type": "git",
"url": "https://gitlab.inria.fr/verifisc/lawspec.git"
"url": "https://gitlab.inria.fr/verifisc/catala.git"
},
"bugs": {
"url": "https://gitlab.inria.fr/verifisc/lawspec/issues"
"url": "https://gitlab.inria.fr/verifisc/catala/issues"
},
"dependencies": {},
"license": "Apache"

View File

@ -1,4 +1,4 @@
# This file is part of the Lawspec compiler, a specification language for tax and social benefits
# This file is part of the Catala compiler, a specification language for tax and social benefits
# computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
# <denis.merigoux@inria.fr>
#
@ -13,8 +13,8 @@
# the License.
name = lawspec
file_extensions [] = lawspec;
name = catala
file_extensions [] = catala;
################################################################
## Styles

View File

@ -3,12 +3,12 @@ from pygments.token import *
import re
__all__=['LawspecLexer']
__all__=['CatalaLexer']
class LawspecLexer(RegexLexer):
name = 'Lawspec'
aliases = ['lawspec']
filenames = ['*.lawspec']
class CatalaLexer(RegexLexer):
name = 'Catala'
aliases = ['catala']
filenames = ['*.catala']
flags = re.MULTILINE | re.UNICODE
tokens = {