In between gallivanting in Sydney, working, and organising to have a new house built, I’ve squeezed in a little bit of work on llgo. If you’ve been following along on Github, you’ll have seen that things have progressed a bit since last time I wrote.
Aside from a slew of bug fixes and trivialities, llgo now implements:
- Slice operations (make, append, slice expressions). I’ve only implemented single-element appends so far, i.e. No append(s, a, b, c, …) or (s, abc…) yet.
- Named results in functions.
- Maps - creation, indexing, assignment, and deletion. The underlying implementation is just a dumb linked-list at this point in time. I’ll implement it as a hash map in the future, when there aren’t more important things to implement.
- Range statements for arrays, slices and maps. I haven’t done strings yet, simply because it requires a bit more thought into iterating through strings runes-at-a-time. I don’t expect it’ll be too much work.
- Branch statements, except for goto. You can now break, continue, and fallthrough.
- String indexing, and slicing.
- Function literals. Once upon a time these were working, but they haven’t been for a while. Now they are again. Note that this does not include support for closures at this stage, so usefulness is pretty limited.
Early on in the development of llgo, I decided that rather than implementing the compiler by going through the specification one item at a time, I’d drive the development by attempting to compile a real program. For this, I chose maketables
, a program from the unicode
standard library package. As of today, llgo can successfully compile the program. That is, it compiles that specific file,
maketables.go. It doesn’t yet compile all of its dependencies, and it certainly doesn’t link or produce a usable program.
So now I’ll be working towards getting all of the dependencies compiling, then linking. In the interest of seeing usable progress, I think I might now take a bottom-up approach and start focusing on the core libraries, like runtime
. I’ll report back when I have something interesting to say.