My Janet Story | Jungle Coder

submited by
Style Pass
2021-09-24 20:00:09

Since Advent of Code in 2020, I’ve been doing 95% of my hobby programming in a language called Janet, which not even I woud have predicted before that. I’d just broken my “heavily multithreaded or bust” phase by using Ruby for a few things, after having been big on Nim, which I gave up because of not feeling at home in the web-development frameworks it has. Both are fine languages in their own right, but where not where my brain wanted to be. Then, I thought I’d give Janet a try during AoC 2020. I’d tried lisps in the past. (And yes, despite what the Common Lisp community has to say, Janet is a lisp, even if it’s not a Lisp), but none of them ever quite stuck for me.

As I was going through the AoC challenges, parsing came up quite a lot, but Janet didn’t have handy Regex Bindings. Instead, it had Parsing Execution Grammars (PEGs). Okay, I thought, I’ll give these a shot. And I ended up actually being able to understand and use them, even if it was a little fiddly at times. A little personal history is in order. Between the years of 2011 and 2016ish, I’d done a lot of self-directed research investingating how to build a programming language, and one of the first steps that came to mind was how to parse things. I ended up reading about a lot of different parsing mechanisms, and PEGs were among them, but the examples I’d seen where hard to follow or understand. But, for some reason, Janet’s PEGs clicked for me. Some combination of maturing as a developer, Janet’s better presentation of the PEG concenpts, or how Janet’s PEG API overlaps with parser-combinators (something else I tried, and did semi-ok at) helped things gel in my head, and I fell in love with Janet.

Which is ironic, because since that AoC challenge, I’ve used PEGs all of maybe 4 times in 50+ projects I’ve started with Janet since. But, I’ve since discovered a lot of other things I like about Janet. The prevailing theme among all of these is that Janet is a collection slowly gathered clean choices. It’s not Innovative like Rust, Haskell, Pony, Scala, or Erlang. It’s a late-2010s lens applied to a mélange of Lua, Ruby/Python, Tcl and Clojure.

Leave a Comment