- Domain Specific Language
- Markup Language
- Declarative programming
- Logic programming
- Low-code and no-code development
- Syntax and semantics
- Formal verification
- Compilation and interpretation
- Application Programming Interface
- Literate Programming
- Legal Expert System
A domain-specific language (DSL) can either be external, when completely standalone, or embedded or internal, when it is just a subset of a larger, general-purpose programming language. The primary use of a DSL is to make programming easier and more accessible to the users of a particular domain, either programmers or domain experts. In computational law, DSLs are designed so that the programs stay close to the legal text, and could be read or even written by lawyers. The main downside of a DSL is its smaller user base, usually related to a lack of programming tooling and help community around the language.
- Martin Fowler, ‘DSL Q&A’ (2009)
- Arie van Deursen, Paul Klint, and Joost Visser, ‘Domain-specific languages: an annotated bibliography’ (2000) SIGPLAN Not. 35, 6, 26–36
A markup language can be considered a rudimentary programming language that specifies how text and/or information should be displayed. Computers can only store plain text in their memory, and so the the formatting instructions (headings, bolding, line breaks, etc.) also have to be stored in plain text. For instance, when writing text in Word or LibreOffice, the formatted text is internally stored in the computer file as plain text written in a (hidden) markup language.
Popular markup languages include eXtensible Markup Language (XML), its domain-specific counterpart for formatting Web pages Hyper Text Markup Language (HTML), Markdown (which this website uses), and LaTeX (for typesetting). One of the goals of computational law is to enrich the structure of legal texts using markup languages to store formatting information, but also information that is legally meaningful, such as cross-references between documents.
- Markdown project page (2022) https://daringfireball.net/projects/markdown/
- HTML introduction (2022) https://www.w3schools.com/html/html_intro.asp
Declarative programming is a movement in programming language design that centers around shifting the program away from specifying how to compute the output, to specifying what the output is. In a declarative programming language, the programmer leaves it to the compiler and the machine to figure out the steps necessary to compute the output, and focuses on the (formal) description or declaration of the output.
Popular declarative programming languages include query languages like Structured Query Language (SQL) for databases, or regular expressions. But the concept can be extended to functional and logic programming languages, in the sense that they do not rely on a state that evolves over time: the objects manipulated are immutable and eternal, as in mathematics. Domain-specific languages often benefit from being declarative, as it can improve the clarity and readability of programs.
Typology examples: Blawx, The British Nationality Act as a logic programme (Sergot et al. 1986), Catala, DataLex, RegelSpraak
- Denis Merigoux, ‘The Specification Problem of Legal Expert Systems’ (2022)
Logic programming is a movement in programming language design that centers around making programs look like the declaration of formal reasoning systems, like Gentzen’s rules of inference. The most famous logic programming language is Prolog, which shares most of its syntax with many variants, such as ASP and Datalog. The execution of a logic programming program mimics the search for a proof of a particular term in a formal reasoning system. For instance, some languages execute forward from axioms by applying inference rules until the goal is reached.
Legal informatics heavily uses logic programming by building on the assumption that law can be represented as a formal reasoning system; once legal rules are translated into inference rules, various proof techniques can be leveraged to extract information and solve legal problems.
- Robert Kowalski, ‘Logic Programming’ (2014) Computational Logic Vol. 9
The dominant form of specifying instructions to a machine for automating a task currently involves writing code in a programming language. Learning the concepts and technical skills required to efficiently read, write and maintain code is a barrier that prevents domain experts from being directly involved in the production of the computer applications that concern them. Typically, lawyers are usually not able to write their own software.
To tackle this problem, low-code and/or no-code development is a movement in programming language design that focuses on changing the interface through which programming is done. Low-code/no-code solutions usually involve web interfaces (nothing to install) using dynamic forms, drag-and-drop of blocks or graphs to structure a program, etc. The main downside of these alternative interfaces to programming is their lack of scalability to large software applications.
- Jason Morris, ‘Code vs. No-Code’ (2022)
- Rob Marvin, ‘Building an App With No Coding: Myth or Reality?’ (2016)
Syntax and semantics are the defining elements of a programming language. Syntax is the answer to the question “what is a program?”, while semantics is the answer to the question “how do programs execute?”.
More precisely, the syntax guides the representation of a computer program in a textual form, i.e. the source code. A syntax error corresponds to a text that does not conform to the syntax rules (for instance, forgetting “;” at the end of a statement in C).
The semantics of a programming language can be defined in several ways. Most of the time, the semantics is given by the behaviour of the compiler or interpreter of the language. But semantics can also be given by a formal reasoning system over syntactically correct programs, thereby abstracting from the compiler or interpreter. Semantic choices include for instance “how does 10 / 3 execute? 3 (integer quotient) or 3.33333333 (real division)?”.
- James Grimmelmann, ‘The Structure and Legal Interpretation of Computer Programs’ Journal of Cross-disciplinary Research in Computational Law (forthcoming)
Formal verification is a set of techniques that can be applied to check whether a computer program satisfies some properties. In this setting, the program and the properties must be translated into a mathematical formulation, so that the checking can be proved correct as a mathematical theorem.
Formal verification is the strongest form of assurance one can have about a computer program, since it accounts for all possible behaviours. However, formal verification fundamentally relies on trusting the mathematical translation of non-mathematical artefacts. In computational law, for instance, careful inspection of how legal properties and concepts are formalised is essential for an accurate assessment of the result of the formal verification.
- James Somers, ‘The Coming Software Apocalypse’ (Atlantic, 2017)
A machine can only compute if told explicit, low-level instructions about how to add, subtract, etc. values from its registries, memory at a specific address, etc. However, modern programming languages allow the programmer to express a computation at a much more high level, with objects, functions, classes, etc. Compilation and interpretation are the bridges between the programming languages and the machine on which the programs actually run.
A compiler performs compilation by translating the text of the original program into a new program, expressed in a more low-level programming language that the machine can execute. The new program can then be run later, and we expect its results to be the same as if we had executed the original program.
An interpreter also translates a program into a more low-level programming language, but it does so in real-time. The difference with a compiler is the same as the difference between a translation and an interpretation of a piece of natural language.
- Denis Merigoux, ‘A misleading dynamism’ (2017)
An Application Programming Interface (API) is an interface to a computer system that can be called by other computer systems. Instead of clicking with a mouse or entering text through a keyboard to interact with a computer system, an API lets other machines send queries to trigger computations, yielding back a result to the querier.
Concretely, the API is the computer equivalent of setting up a timer to switch off the lights instead of pressing the button: it lets you automate a workflow that can consist of calling many different computer systems to produce a more complex result. Legal libraries have for instance set up APIs to let users automate the retrieval of legal texts through complex queries.
- APIDays, ‘The API landscape’ (2022)
Literate programming is a programming technique that consists in interleaving computer code with its documentation, usually in the form of comments to the code. By putting the documentation very close to the lines of code it is supposed to describe, this technique aims at improving the ease of code review, thus making it easier to catch errors.
In the case of computational law, the legal text itself can be considered as the de facto code documentation, hence the temptation to use it as a basis for literate programming. However, deep structural mismatches between the legal text and the computer code challenge the application of this technique.
- Donald Knuth, ‘Literate programming’ (1984)
In its original form, the term legal expert system designated the artefacts produced by formalising a set of legal rules using knowledge representation tools like declarative or logic programming. The main feature of the legal expert system is its ability to be queried in a flexible fashion, to answer all kinds of relevant legal questions.
Ideally, the interface of a legal expert system should be amenable to its direct use by lawyers, without the mediation of programmers.
Typology examples: Traffic Regulation Application and Comparison System (TRACS), DataLex, TreeAge
- Philip Leith, ‘The rise and fall of legal expert systems’ (2016) 30(3) International Review of Law, Computers & Technology 94