Skip to content
NorscodeNorscode

What is Norscode

A programming language where the keywords are Norwegian, the runtime is capability-based and the compiler is written in the language itself.

Norwegian syntax

Norscode swaps the English keywords for Norwegian ones. The structure is the one you know from other languages — it is the words that are new.

funksjon storst(tall: liste_heltall) -> heiltall {
    la beste = 0
    la i = 0
    mens i < lengde(tall) {
        hvis tall[i] > beste { beste = tall[i] }
        i = i + 1
    }
    returner beste
}

You have hvis and ellers (if and else), mens (while) with bryt and fortsett (break and continue), and prøv / fang / kast (try / catch / throw) for error handling. The truth values are sann and usann.

Types

The types are named in Norwegian: tekst (text), heiltall (integer), boolsk (boolean), liste_heltall (list of integers) and ordbok_tekst (string map). Functions declare parameter and return types, so mistakes are caught when you run nc check, not first in production.

A runtime that says no

This is the most important difference. A Norscode program has no access to the outside world until you grant it. The capabilities are given when the program starts:

NORSCODE_VM_CAPABILITIES="disk.read,net.tcp" \
NORSCODE_VM_DISK_ROOT="/srv/data" \
NORSCODE_VM_NET_SCOPE="127.0.0.1" \
  nc run tjeneste.no

The program above can read under /srv/data and talk to localhost. It cannot write to disk, cannot call out on the network, and cannot read environment variables. Not because it chooses not to — because the runtime does not give it the ability.

It means a dependency you have not read through cannot read your keys or phone home either. Access is something you grant, not something that is assumed.

The standard library

The library is broad on purpose, so ordinary tasks do not require external dependencies: std.web and HTTP, std.db for databases, cryptography such as BLAKE2b, ChaCha20-Poly1305 and Argon2id, std.base64, std.dato, std.csv, std.dns and std.fil.

Self-hosting

The compiler and toolchain are written in Norscode. The language builds itself, without a host implementation in another language underneath. It is also the strictest test the language has: if it is not good enough to write a compiler in, it is not good enough.

Get started