Escrito en Piedra

Not good start on Monday.
Login

Zig plaything.

I didn't feel too well during the weekend, so little progress on day job. What I did advance was on Zig fun stuff.

The current experiment is a Protocol Buffer binding. The goal is to get the full parser in comptime, so no need for protoc, yet it builds fully static type checked structs from the source.

The first attemps was a functional-style, with getXXX, expectXXX and consumeXXX functions for the different kinds of syntax objects and passing a "rest" text slice to advance the parser.

The downside is that since Zig doesn't do multiple return values nor destructuring assings, each function could only return the object or the "rest" text. I didn't want to put pointer arguments to fill objects, so things were manageable but was hard to recognize the syntax from the code shape.

After a couple experiments, I confirmed that it's possible to have an object with mutable pos field and pass it around at comptime. Now the code is much more readable, and it is far easier to recognize the syntax. There are a few rough parts about the interaction between comptime and runtime, but in many cases it's solved by making big comptime blocks. Since I want the whole parsing to be comptime, and only return the final struct (and not the parser object), I'm ok with that.

ISP woes

Once again, the cable router is acting up. And once again, it magically worked at the :40 mark. I added a "Ping (ICMP)" entity to the HomAssistant settings, so now I have a simple status record.

*** Edit ***

The router failed again, now between 9:44 and 10:02. Nice to keep an automated record.

back to index