Added some new features to my hobby compiler project, Pholyglot. Maybe nothing interesting from an OCaml perspective, it’s a pretty basic amateur home-made compiler system, nothing fancy. The weirdest aspect of it is that it outputs C-code that is also valid PHP-code, so called polyglot code (semi-readable).
Since I’m career-locked into PHP, I’m writing myself out of it with my own compiler.
Another motivation is a slight disappointment in recent languages, like Rust, which does not, according to me, adhere to the 80/20-rule - that the most common use-case should be easy, and that in 80% of cases, you don’t have to be fast, but you should be able to be fast (instead of forced to be fast). Hence the opt-out-of-GC experiment.
The current GC is just Boehm. Might be interesting to try with ref-count too. Proper tracing is out-of-scope for the project (too hard… and requires headers etc, can’t combine it with manual memory, afaik).
Main OCaml src is here: https://github.com/olleharstedt/pholyglot/tree/main/src/lib
Most recent blog post: A memory-polymorphic, polyglot implementation of SplDoublyLinkedList (as transpiled by Pholyglot 0.2-betachicken)