six to seven months of coastal living: coastML status report for September 2022

Today marks seven-ish months of coastal living; let’s checkout the running burndown chart:

So we’ve added quite a bit of code these last two months…​ some personal things came up that delayed writing August’s blog post, but I’ve continued hacking away at things as needed. Little ticky-tacky bugs aside, there’s two new major modules within the system: a Compiler and CarpetJavaScript.

The first lifts many of the AST → AST forms that were previously within the CarpetPython module. These transforms are useful to multiple code generators, and honestly should be above that sort of level. The compiler now checks for function existence, the validity of case arms, and does various transforms on code, such as lifting lambdas. It’s also just about at the point where it can be used to check the body of fn forms as well; the last step there is just to start collecting a spaghetti stack of environments.

The second is just a straight-forward coastML → JavaScript code generator. There are still some forms I need to flesh out, such as various pervasives, but the general shape is coming together. It’s been interesting to consider another language, since that generally forces you into a good structure for where other AST-level transforms should live. The next step will be adding types, so that languages like Golang become easier, and so that we can annotate JavaScript & Python with typing information as well.

Lastly, I exposed the Compiler as a command on the command line:

% ./coastml
usage: carpet.py [command] [file]
commands:
load - load a file, and dump the resulting coastML
compile - like load, but run the compiler too
python - dump python from a coastML file, without the compiler
cpython - dump python from a coastML file, with the compiler
javascript - dump javascript from a coastML file
note, the last two will be merged at some point

This next month, I want to focus on the Compiler as well as the basis library, so that we can get some really great code together, and start generating code from coastML that we deliver to other teams.