The Journey: Early Milestone

Developing a computer language has been the most fun and challenging software engineering experience I’ve had.

Like other software projects, early development was focused on building modular functionality around scanning, parsing, analysis, emitting code and executing code. Getting the compiler to interface with the VM and the interpreter to work with the memory manager and JIT compiler was a constantly evolving break/fix process.

One memorable milestone was when I was able to implement a balanced binary tree that exercised all stages of the compiler and runtime. The code was compiled, interpreted, translated to machine code at runtime and unused memory was collected. Achieving this milestone gave me the confidence that I might be able to actually implement a general-purpose programming language.

Faster Memory Collection

With the latest release (4.1.2) the overhead of the memory management is 2% to 6%; down an order of magnitude. Made changes to thread locking, was shocked and verified the results on Windows and macOS.

Odd Bug, Good Result

Spent two days hunting down a memory leak that only impacted and showed up on macOS. Turns out that the the following line caused memory to grow with each garbage collection cycle.  The upside is that I became familiar Instruments a great memory and performance monitoring tool that’s included with Xcode. This tool also found a tiny bounded leak in the JIT compilers that leaked extra 4-8 bytes with each compiled function. Luckily, the number of compiled functions is bounded however no other leak tool (i.e. Valgrind Visual Leaks) found it.

macOS Support

Per the release of Mojave (10.14) I’ve upgraded my development hardware and am focused on cross-platform SDL support for macOS. There are a few known bugs with the current release of SDL2 (2.0.8) that are being addressed. Once those fixes make it into a stable release will push out v4.1.1. This release will also include some minor bug fixes to the Objeck compiler for example allowing “break” statements in nested loops.

Native Support for 64-bit Windows

Over the past couple of weeks I’ve added native support for 64-bit Windows. To do this, the code was overhauled to be more portable and maintainable on all platforms. Code generated by all JIT compilers is now more efficient and there’s better hand-off between interpreted code and machine code.

In addition, the memory managers have been tuned for 32-bit and 64-bit environments respectively. This refactoring will allow Objeck to be ported to other platforms (i.e. Raspberry Pi) more easily.

BrainF**k

Wrote a simple BrainF**k interpreter for a Rosetta Code task and found out that it’s a great way to teach kids about computers and introduce programming concepts. Kids can quickly pick up the language’s 8 commands and teach the machine how to do basic math using counting. Used the language to teach my daughter about multiplication and ASCII encoding.

Implementation Notes

Added implementation notes to GitHub for the general design and implementation of Objeck. Over the years, I’ve learned a lot about how compilers and runtime systems work as such I felt obligated to better document what I’ve learned. One of the most fascinating aspects of Objeck was implementing the debugger which I still need to add design notes for.

Design notes:
General Design
Compiler
Virtual Machine