Forester as a Target Syntax [weekly-2025-06-02]
- June 2, 2025
- Patrick Ferris
This week included some time finishing opentrace and subsequently folding it into shelter. I have been writing up some more of the draft paper for shelter which I am excited to share in the near future.
I revisited the upgrading vpnkit PR and pushed some more fixes. I have been thinking, again, about the promise of a direct-style world for OCaml that just hasn't quite landed yet. C'est la vie.
Forester and Graft
- June 2, 2025
- Patrick Ferris
I spent a bit of time finally pulling out my changes to Forester to add markdown and bibtex support into a standalone tool: graft.
Graft [graft]
- June 2, 2025
- Patrick Ferris
- https://github.com/patricoferris/graft
Graft is a Forester preprocessor.
It takes a forester (a directory of trees) written in a mixture of Markdown, Bibtex and Forester syntax and produces a new forest completely written in Forester syntax.
Usage
- June 2, 2025
- Patrick Ferris
graft simply preprocesses a forest generating Forester trees from .md, .bib and .tree files. It will copy the structure of the input directory in the output directory.
$ graft preprocess --output=grafted-trees trees
$ forester build
This assumes that you have updated your Forester toml file to put the grafted-trees directory as your source of trees.
[forest] trees = [ "grafted-trees" ]
Example
- June 2, 2025
- Patrick Ferris
A typical "tree" might look something like
---
title: Opentrace and Supervisions
date: 2025-05-26
author: Patrick Ferris
---
Over the past two weeks I have mainly split my time (amongst many things) developing [opentrace](open-trace)
and doing revision supervisions.
```forester
\put\transclude/numbered{false}
\transclude{open-trace}
```A few things to note:
The
yamlfrontmatter allows you to add some of the metadata fields from Forester.At any point in your markdown there is an escape hatch to Forester using a
forestercodeblock.
It is very satisfying to find the separation of concerns works quite well. For a while I had been rebasing my development branch on Forester. I was also worried about trying to get the code upstream as it pulled in many dependencies. It seems that I have a very workable solution. I welcome contributions to graft including extra input formats. I am also considering extending the Forester configuration to contain some graft configuration for how it should generate new trees (e.g. at the moment every entry in a bibtex file is given a new tree).
Maths Support
- June 2, 2025
- Patrick Ferris
As part of that process, graft now supports Markdown KaTeX. For example:
Definition. Mergeable Replicated Data Type Implementation [mrdts]
- Patrick Ferris
A mergeable replicated data type (MRDT) implementation for a data type \tau is a tuple D_{\tau } = (\Sigma , \sigma _{0}, do, merge) where:
\Sigma is the set of all possible states at a branch,
\sigma _{0} \in \Sigma is the initial state,
do : Op_{\tau } \times \Sigma \times Timestamp \rightarrow \Sigma \times Val_{\tau } implements every data type operation,
merge : \Sigma \times \Sigma \times \Sigma \rightarrow \Sigma implements the three-way merge strategy.
Definition 2.1 from "Certified Mergeable Replicated Data Types".
Revision Supervisions
- June 2, 2025
- Patrick Ferris
I have been doing revision supervisions for Discrete Maths and Foundations of Computer Science. I have also been marking Operating Systems past paper questions for the same group of first years.