Skip to content

Instantly share code, notes, and snippets.

View Virtlink's full-sized avatar

Daniel A.A. Pelsmaeker Virtlink

View GitHub Profile
@Virtlink
Virtlink / myscript.sh
Created September 10, 2025 09:47
Shell script template
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o noclobber
set -o nounset
#set -o xtrace #debug
# ...
@Virtlink
Virtlink / Makefile
Last active November 4, 2025 12:25
Makefile template
# See: https://gist.github.com/Virtlink/b713707ede3f74bee2d902cf18f8d110
# Make settings
SHELL := /usr/bin/bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help
.ONESHELL:
.DELETE_ON_ERROR:
.SILENT:
MAKEFLAGS += --no-print-directory

Origin Tracking

Origin tracking is the idea to build an origin relation between input and output terms of a transformation in a term transformation system (TRS). It was first proposed by Van Deursen et al. in 1993 in the eponymous article. The origin relation can be used to traverse from a result term, to the term before the final transformation happened. This relation can be followed further, all the way back to the original input term before all transformations. Examples of uses for this relation (from the paper) are: constructing language-specific debuggers, visualising program execution, and associating positional information with messages in error reports. The first two examples relate to using the TRS to implement evaluation (interpretation) of a programming language, where the abstract syntax tree (AST) of a program is a term that is transformed to execute it. The origin relation allows a debugger or visualiser to show the execution one step at a time. The third example uses the origin relation tran