Moving projects to Loci

It’s always been my intention to develop the Loci programming language as a tool that I would regularly deploy myself and this year that’s going to start happening!

The language and compiler have reached an early stage of maturity, with a substantial mix of implemented language features and a small (but quickly growing) set of useful standard library modules. Hence this seems the right time to move some of my projects, currently written in C++, over to Loci, both to take advantage of the strengths of the language, to guide future design decisions of the language and as a real-world test of the compiler. Chain Reversi has already been ported to Loci and has been particularly useful when optimising the compiler; I consider quick build times extremely important and I’m pleased to say both that the design of Loci means it can be expected to compile much faster than similar C++ code and that this is borne out in practice.

The first project to move over is my ‘second’ (but slightly neglected) project, OpenP2P, which is basically a set of libraries that make it easy to develop applications that use peer-to-peer networking. One of the aspects that held OpenP2P back was the lack of good event notification/handling in C++ (which was basically implemented as a layer over boost::asio) but fortunately Loci has std.event, which in my opinion follows a very clean approach to event signalling. So I’ll be moving OpenP2P across and integrating it neatly with the standard library modules.

There’s another reason for making this change. Loci has presented me with a couple of problems:

  • It’s too much fun to work on!
  • It’s too successful!

Hence it’s starting to dominate my projects time, which has led to it becoming relatively well structured but on the other hand my other projects have been neglected. By moving these projects over to Loci I get to work on both at the same time! I also get the thrilling feeling of the last 5 years of designing Loci and building the compiler coming to fruition in a very practical way.

Building LLVM and Clang

Often it’s useful to build the latest LLVM and Clang from source code, rather than relying on often out-of-date packages available in repositories. This build process can be done quickly and easily with CMake, but it’s worth taking care to ensure the right options are passed.

The following commands will build LLVM and Clang to be installed in /usr/bin (and /usr/lib, etc.). Note that the ‘-j’ option tells make how many recipes may execute at once; use this to your advantage to dramatically reduce the build time on multi-core machines!

The following directory structure is assumed:

(I.e. both LLVM and Clang have been downloaded and moved to /llvm/llvm-src and /clang/clang-src respectively.)

LLVM

Clang