November 2018 Update

Nov 28, 2018 · 1060 words · 5 min(s)

· update ·

I am pleased to say that this past month has been quite successful in terms of getting things done. I have perhaps not got as far as I would like but I have certainly progressed.

To recap, at the start of the month I decided I would spend the whole month working exclusively on my little programming language. I wanted to have a bit of a push on it. Even a small language can be quite a bit of work. That is if you are aiming for a typed language that could theoretically be compiled to machine code.

Lets talk about the code:

About a day into the month I decide it was time to throw away the code I had and start again. The code didn’t feel right, it was hard to put my finger on it but it was not enjoyable to work with.

While this cost me a little of time I was still able to achieve a fair bit.

Here’s a list of the work done:

At the moment all this is working on the AST and I have not transformed it into a better data structure. I kind of want to get to the interpreter stage with the AST intact, the pipe dream is doing some compile time reflection but that is a long way off.

Abnormally for me I decided to release the source code early over on github. It is approximately about 2000 lines of code at the moment and I would treat it as a very early draft.

It is sprinkled with TODOs and has a mix of coding styles. Basically it is a bit of a mess. I don’t think this is a bad thing it just reflects the fact I have been throwing code in pretty quick.

It also contains some really bad algorithmic decisions such as searching though unsorted vectors and we allocate small objects rather than using memory arenas.

So pretty much prototype code. Well prototype code that I am confident that I can refactor into something stable and reasonably fast, I just don’t want to do that yet. The goal is to get a minimal version working before starting to improve things.

What do I mean by minimal?

In terms of code features I mean a simple compiler the compiles down to a minimal VM. The VM will look a bit like an imaginary piece of stack based hardware (no registers). This will give me the confidence that it will be fairly simple to move to properly compiled code when needed.

It also means the language is very minimal, consisting of not much for than

Enough to write very small examples but nothing more.

After Minimal?

Obviously adding more features but doing this gradually while improving the code-base and adding more testing. That pretty much sounds like every software project that has existed doesn’t it?

Realistically once I get the VM working I will probably spend a couple of weeks tidying up the code and improving testing. Then I will start to add features.

Its name?

If you followed the link above then you will know I decide to call the language nhb. It has a nice little personal story to it that I will write about at some point. It is an acronym for No Hassle Beach which I think reflects what I want the language to be.

No Hassle Beach: The language you want to escape into.

I have a lot of work a head of me to achieve that goal. It should include:

At the moment the plan is for it to be a system level language, so you will be managing your own memory. Perhaps this conflicts a bit with the name. I am not 100% set on this. There is a small chance that if we can’t find a good solution I will head into the world of garbage collection.

Probably the final bit of information is I am targeting myself as a user of the language. I want to create a language I want to use.

Imagine a programmer coming home from work, enjoying some family time and then retiring to the coding den. I want them to reach for nhb. Or perhaps at a weekend they head to a coffee shop for a bit of coding escape.

This puts forward some interesting constraints. It is for lone programmers/small teams, that means code bases of 10K lines of code is an expected code base size. Give or take an order of magnitude. I can also assume some programming intelligence as it is someone who loves to code (An argument for manual memory management).

It also means a ruthless focus on programmer efficiency when it comes to tooling.

The coming month.

Currently my plan is to continue working predominately on nhb. I am about to start on the VM which I imagine will take a little while and then compiling the AST down to it.

If I get both of these done in December I will be quite happy. With Christmas holidays approaching, the end of the month will be highly productive or result in no code being written.

Life and other stuff

I am gradually starting to get back into running. I have not run properly for a while and weight is a factor here so I may end up adjusting my eating habits.

I would also like to introduce a couple of daily habits like reading and drawing for 15 minutes each day but I suspect that won’t happen this month.

Finally I seem to be getting pulled into emacs. Emacs is like a puzzle to me and quite addictive. I use EVIL mode to save my fingers. It may become my defacto light weight editor and pull me away from nvim.

Lets be explicit about the goals, so we can judge me next month

The urge to track everything is strong this month.