Krug is a programming language for systems programming. The compiler is a compiler-as-a-service, which means that the compilers runs as a server. Each compilation phase is cut up into an API route which can be invoked from a client.

Features:

  • Fast
  • Statically Typed
  • Optional garbage collection
  • Type inference
  • Minimal runtime
  • Native Language Server

Demo

Goals

The goal of Krug is nothing fancy: make another language that people might want to use. Krug in itself is an experiment to see how the architecture of a 'compiler as a serivce' works in a 'real world' scenario.

The Vision

That being said, there is still a vision to create a polished ecosystem around Krug:

  • Support LLVM as the primary target for code generation. Right now it's C to lay the grounds for a prototype: features first - consider LLVM an optimisation,
  • Solid documentation/resources for programmers and non-programmers, in addition to clear, concise, and queryable error messages
  • CaaS and LSP should work well together out of the box to ease development for tool creators
  • Choice of garbage collection, manual memory management, reference counting, AND (weak) ownership.

These are just a few of the goals for Krug. There are many more ranging from a bytecode backend, to a package manager, linter tooling (fmt, etc), and so on.

Tooling

Due to the architecture of Krug, there is a lot of choice for tooling and how you compile your code. Because of this, the section below aims to compile and summarize most of the tools available and where you can find them.

Krug (Client) — GitHub

Krug is one of the official client implementations. It is implemented in JavaScript, and is generally a good choice for small Krug programs or hobby programmers.

If you were to write some larger programs, it is recommended that you use an alternative client, as they are typically faster.*

Additionally, there are a few configurations you can make, such as passing the --sendpaths flag, to avoid sending large packets of information back and forth from the client to the server.

Caasper (Server) — GitHub, Website

Caasper is the compiler itself for the Krug programming language. This is a requirement for programming in Krug. You could either run this locally on your computer, or you could host this on your home server, or on a DigitalOcean droplet, or wherever you choose to.

There are downsides to this, the #1 being the latency from you to where Caasper is hosted. If running locally, it is a good idea to specify the --sendpaths flag to your client so that you aren't sending files over the network.

*As of writing this, there are no other clients that are kept as up to date as the JavaScript client. So for now you are stuck with JS speeds. Sorry!

Kruggle (Server+Client) — GitHub

Kruggle is a server & client, where both the compiler and a fast client are provided to get programming out of the box.

It is worth specifying that Kruggle is not its own project. It is a 'driver' that will launch an instance of the server in the background as well as pass the given input files onto the client.