Elektrine lite

← Feed

@citizen428@chaos.social

Post #3808778

2026-07-10 07:30 UTC

Over the years, I've built a fair number of DSLs in #Ruby for all kinds of things. For one of my current clients, I'm building one in #Zig, and it's definitely a very different approach: the DSL is syntactically (but not necessarily semantically) valid Zig, and a small parser transforms the `std.zig.Ast` into something that later gets executed. It works better than I expected, and I promise, the approach makes sense within the constraints of the project.

Replies (1)

  • @citizen428@chaos.social 2026-07-10 07:32

    The first parser iteration worked on a set of declarative Zon files, but it became increasingly verbose to express everything I needed. That's when I realized that I was tediously hand-writing a pseudo parse tree, and the DSL emerged almost naturally.

    Open ##4129490