Coding 2023-07-02

By Max Woerner Chase

I ended up deciding to try to patch together the scanning code from one of my Lua versions. While I can express a bunch of the basic primitives fine, as I get to somewhat higher level stuff, I'm hitting imperative constructs, and, like, while I can use those in OCaml, I want to try to avoid them.

Like, let's see. I've defined a function called str. Its OCaml version will take a source string and a control record. The first major thing it does is enter a while loop that advances the state of the control record in various fashions.

By laying that out, I seem to have gotten a little further in implementing this stuff, and fixed a few issues along the way. I hadn't quite grasped that OCaml's effect system allows you to pass effects around, and invoke them separately from constructing them. This makes sense in retrospect, but it's not something I currently need, so I had to change some code.

Anyway, big thanks to ocamlformat for taking my stream-of-consciousness one-line monstrosities and making it so that at least I can read them.

Finally, I should be about done for tonight. I've got a rough template for how to port the rest of the code, and then I can try to give it a nice interface.

Good night.