I open source software when I can. Here’s a sample of what I’ve put out there, and why.
runeset is a data structure I came up with while working on PEG VMs. It exploits the structure of UTF-8, and lots and lots of POPCNT, to detect codepoint membership without having to decode the byte stream, and supports all the classic set operations in a timely manner. For strict matching, it’s competitive with a DFA but in an NFA’s worth of memory.
mvzr is a minimalist regex engine written in Zig. It implements a simple byte‑code virtual machine inspired by LPEG, with around two thousand lines of code and no dependencies other than Zig’s standard library. The library is fairly featureful for a regex engine which has never heard of Unicode: but it backtracks, and it doesn’t capture. Another thing it doesn’t do is allocate, making it suitable for both comptime and runtime use.
I whipped this up in a dreadful hurry, because I wanted a Zig-native regex engine and there was none such. It’s seen use in several projects mentioned later; people seem to like it. Someday the fabled ‘production ready’ Zig regex will land, and mvzr will fade into the distance. It will have had a good run.
zitron is a compiler-compiler, based on a handwritten port of Lemon, and generating Zig code. It includes the intermediate Lemon port, which generates the same outputs from the same inputs and flags as the original: having gone to the trouble on the way to my goal, it seemed a shame to leave it stranded in the Git history.
I want Zitron to be nice to use. To that end I’ve written a tree-sitter for it, and a language server, which also acts as a client for ZLS, to handle embedded Zig code. I’ve spiffed up the grammar-grammar a bit, and have a few more quality-of-life improvements in the pipeline.
Just needs a good lexer. Watch this space…
ztap is a Zig test runner which emits TAP, a venerable output format for tests which just about everything understands. I’ve found this useful with agent harnesses, especially with the flag flipped which times each test and reports what it sees.
zelda is a mixin library for building intrusive singly or doubly linked lists in Zig. Its purpose for existence is to be better than Zig’s standard library offering with the same functionality. Mission accomplished I guess.
Thing about linked lists is: those of us who reach for them, don’t tend to even consider pulling in a library dependency in order to have them. They’re easy right up until they aren’t: and that’s why zelda, because it’s a mixin, if your T has a ?*T field on it you can just point Zelda in that direction and get mergesort, filters, and other stuff which is annoying to get right.
I consider it a good illustration of what Zig’s type reflection is capable of, and a better illustration of why comptime should not be crippled forever. That deserves a post one of these days.
A snapshot testing library inspired by a TigerBeetle blog post. mvzr was written to use in ohsnap, along with what’s become muad_diff.
obelizmo, stripped of aspiration, is a rather capable ANSI/XTerm string markup library. The hard code in here handles jugging stacks of styles so composition works the way it should: if you add a red word in a green sentence, that’s what you get. I like “do one thing, well” libraries, and obelizmo hits the mark.
This is a replacement for Zig’s std.unicode which is faster and easier to use correctly. You may notice text, ‘strings’ if you prefer, is a recurring theme here.
A port of diff-match-patch, UTF-8 native, taking full advantage of Zig’s closeness to the proverbial metal to run faster and copy less.
This is driving a lot of code, much of which isn’t public, some of which will be. Once you have precise and fast diffing, you see it everywhere.
Zig’s std library again: while it can print a quoted string, it does so by byte quoting anything which isn’t ASCII, so that “😒” comes out as "\xf0\x94\x98\x92". I cannot endure such a thing, so I created an alternative which doesn’t slap every non-English-language native directly across the face. No way, “Jos\xc3\xa9”!
I want to like Julia more than I really feel like I can. It’s not the Dylan we deserve, but it’s the Dylan we have. While I don’t write actual software in Julia these days, the REPL is always running.
ToggleMenus.jl extends Julia’s TerminalMenus to create menus where each line can cycle through multiple states. It’s a neat little thing and I wish I had more use for it.