# PyFlies: A Domain-Specific Language for Designing Experiments in Psychology
## 1 Introduction  
It is hard to imagine work in a modern psychology laboratory without the use of personal computers. These ubiquitous devices are becoming more and more capable each year, being able to present experimental stimuli as well as to record a participant's response with great accuracy. In the past, the development of psychological experiments required a great effort and a lot of low-level coding. Fortunately, things have changed in the last two decades and nowadays we have an array of freely available open-source software tools and libraries that make the process of developing psychological tests much easier. Based on the experiment specification approach, we can divide the existing software into two categories: (1) GUI-based and (2) text/code-based software. GUI-based experiment builders use a click/dragdroep interface to construct an experiment (e.g., OpenSesame [1], E-Prime [2], PsychoPy Builder [3], Lab.js [4], Gorilla [5]). This style is a good fit for practitioners without a programming background. Those builders are easy to learn by navigating the interface using a mouse and trying options, i.e., they are suitable for trial and error learning. They often offer a good overview of the experiment structure, although for the details the users usually have to drill down into the dialogs or other GUI elements. Text-based builders use textual languages as a way to specify the experiment (e.g., PsychoPy [3], Exypriment [6], jsPsych [7], PEBL [8]). While they are initially not that easyto start compared with GUI builders, they offer some benefits. First, we can leverage all the development in text editing in recent decades (syntax highlighting, code completion, tooltips, quick fixes), which usually can be configured in contemporary editors without much effort. Second, standard text editing idioms can be used such as copy-paste, code commenting, etc. Third, the representation is the same as the storage format, which enables the usage of any text editor to read and edit the experiment. Fourth, plain text is perceived as a future-proof format. If the text-based builder ceases to be developed, we can still open and read experiments in the future using a plain text editor. Additionally, last but not least is a collaboration which is the key in today's development. Text-based syntaxes facilitate the usage of standard version control tools such as git [9] and mercurial [10], and services such as GitHub and GitLab to enable distributed collaboration and tracking of the history of changes. Indeed, distributed version control systems have started a revolution in the global collaboration in software development. The GitHub Octoverse report from 2020 ([[https://octoverse.github.com/](https://octoverse.github.com/)]([https://octoverse.github.com/](https://octoverse.github.com/)), accessed on 1 July 2021) shows that GitHub has over 56 million developers who added over 1.9 billion contributions in the year 2020. The report shows that the numbers are increasing rapidly year after year. It is hard to achieve this level of collaboration with GUI-based experiment builders as their storage formats differ from the display format. While the user interacts with the tool using some form of graphical syntax, the experiment is stored in a format that the user is not familiar with (e.g., XML, JSON, or binary), which requires the development of custom tools for version control. This hampers the merging of concurrent changes and the investigation of the history of changes. Textual languages can be divided into two categories: (1) General-Purpose Programming languages (GPLs) and (2) Domain-Specific Languages (DSLs). GPLs are programming languages that can be used to build general computer software (e.g., Python, JavaScript, C).