Over the Bridge

Screaming into the Void

New Projects!

Posted on December 11, 2020

I've started two new projects! One of them meshes with my existing stuff; the other is kinda unrelated. Both are programming related.


I've started writing a C++ liquid parser/renderer, with an eye on embeddability, performance, and sandboxability.

The repository is hosted on github here.

It's still in the early stages, so likely has more than a few memory bugs, but I've got bindings up and running for C, and Ruby, Perl (both using the C bindings). I've also strapped it to cmake, so there's a semi-legitimate build process involved (though my development builds are still built through a hand-written makefile.

I'm planning to embed it in nginx-xapian, my other open source C/C++ module. So we'll see how it goes. Early indicators are good, though! I've already got it more feature-ful in terms of syntax than Shopify's existing liquid implementation (i.e. we support parentheses and actual operators), if you want them; though you can always implement the strict Shopify version with a single call.

Another cool thing about it is that it allows for multiple dialects, like with the perl liquid module, and almost all the functionality of the language is tied to the dialect, rather than the core implementation. The only tag that exists in the core is {% raw %} (as that's a lexing hint); everything else can be modified by anything using the library; allowing you to very easily add new tags, operators, filters, and other constructs as you load the thing up; though it does come with a fairly comprehensive standard liquid implementation, that includes all the normal greatest hits like {% for %}, {% if %}, and the like; the only thing it doesn't have is stuff that would require external libraries to properly implement, like JSON serializing, and whatnot; but that will eventually be provided with examples.

Performance is good too; I haven't really even done an optimization pass, and it already runs 10x faster than Shopify liquid does, even when called from Ruby with near-identical calls (both parsing and rendering). I think that, combined with the embeddability is going to make this a general win for most projets I want to throw it into; some of which will actually be work-related (though I'll only work on the library in my spare time).

I'm aiming to keep the full implementation under 5KLOC, and there's definitely room for improvement on the way it was done; but I'm hoping, after a few polish passes, it'll actually work nicely both at work, and in hobby projects.

Pre-Confederation Ornithology

My dad has always been majorly involved in birdwatching; being in the executive of a number of non-profit birding organizations around Montreal. Over the years, he's aggregated and transcribed a ton of early Canadain material on ornithology, and has finally decided to publish some of it online. I've helped him create a website for this purpose over here.

Looks familiar, doesn't it?

In addition to helping my dad, also helped me refine the static-site generation framework I wrote for fun, that builds this site. So it's a win-win all around.