Archie the Archon, the mascot: a hooded stone figure laced with circuit traces, reading an open book
Archie the Archon
Introduction

Why Archon

An object-oriented language without inheritance, built on a single concept — and one that hosts several sub-languages under a single structure.

Most languages ask you to pick a side: safety or control, the high-level view or contact with the machine. Archon refuses that bargain. It defines one way to describe data and several ways to write the algorithms that work on it — from automatically managed code all the way down to assembly, in the same file, with no seam between them.

[Your personal note: why you wrote this language, what you were after that did not exist elsewhere. One or two paragraphs, in your own voice.]

Object-oriented, without inheritance

Archon has a single type concept: the archetype. It covers the plain data structure and the type that carries behaviour alike — no struct on one side and class on the other, no choice to make at the moment you know the least.

And there is no inheritance. No base class, no hierarchy to untangle, no method whose implementation you go hunting for three floors up. Reuse goes through two explicit mechanisms:

  • extend adds behaviour to a type — including one you do not own; the extension is declared in one file and applied in another;
  • proxy of composes by delegation: your type holds another and forwards what it does not handle itself.

Typing is structural: a type matches an interface as soon as its shape matches, with nothing to declare and no ceremony to perform. What counts is what the type is, not the list of what it has signed up for.

One language, several sub-languages

This is the second idea, and the more unusual one. Archon separates the structural part — types, fields, visibility, memory layout — from the algorithmic part, the bodies of methods. The first is single and fixed. The second is written in whichever mode you declare, method by method, with @mode:

  • managed — the full language, memory reclaimed for you. The default, and where almost all of your code lives.
  • unsafe — the same syntax, plus the means to drive memory yourself: new, delete, destruct. For the few places where the decision has to be yours.
  • asm — the body is assembly, with one version per architecture.

The list is open: more modes will come.

What makes this possible is precisely that the structural layer stays single. Every mode already agrees on the memory layout — an archetype Point is two contiguous float64 values, whether the body handling them is garbage-collected or written in raw assembly. So there is no boundary to cross: no FFI, no marshalling, no defensive copy, where mixing two languages normally demands all three. The mode changes how the algorithm is written, never what the data looks like.

In practice: your program is written at a high level, and the loop that matters drops down a notch — in the same type, without switching tools, without leaving the file.

Compiled, yet immediate

The same tool, archonc, produces a native executable optimised by LLVM — or runs the program on the spot, with no compilation step. That second mode is what runs the examples on this site, in your browser.

And the compiler itself is written in Archon: it compiles itself and reaches the fixed point of the bootstrap. Not a line of any other language has been in the compiler since version 0.0.6.

The name

ΑΡΧΩΝ — ἄρχων, árkhōn, “the one who rules”: the chief magistrate of the Greek cities, and the root of “monarchy”, “hierarchy”, “anarchy”. The same word gives the archetype, the language’s central concept, and the source file extension, .arc: ΑΡΧ transliterates to arc. One Greek word under the name, the concept and the extension.

Two principles that govern the rest

Ambiguity is an error. When a piece of code admits two readings, the compiler refuses instead of deciding silently. You spend thirty seconds being explicit; you do not spend three hours working out why it chose the other one.

No abstraction costs anything at run time. Stack unwinding goes through tables placed outside the code: a function that throws nothing pays nothing for the ones that do.

What this site offers

A course in numbered sections. Whenever a notion is illustrated with code, the complete program is in the page with a Run button — and you can change it before running it. Everything runs in an isolated sandbox: no network, limited time and memory. There is nothing to install to get started.