Follow

I started writing a Kotlin implementation of kdl.dev last week (for no specific reason) and it's actually *really fun* to work on! Admittedly, it has been a while since I enjoyed working on something this much.

code.horrific.dev/james/kdl-kt

I did learn that, while Kotlin's `sequence` utility is very cool, it is *not* just a sequential Iterator! They can actually be executed multiple times, which caused some really weird bugs in my parser.

Good news: there's an `iterator` function that is! kotlinlang.org/api/latest/jvm/

I'm using this to effectively parse the document *during* iteration - so the implementer can do an early return or discard extra nodes without parsing the entire file.

(I'm sure other parsers already do this with far more efficiency - I'm just reinventing wheels for fun!)

Show thread
Sign in to participate in the conversation
Horrific.Dev

A group of individual developers and enthusiasts with a focus on independent services, software, and technology.