Skip to content

About

A curated list of low level programming languages (i.e. suitable for OS and game programming)

Topics

Resources

Stars

288 stars

Watchers

14 watching

Forks

Latest commit

 

History

107 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Note

For a table of contents press the button with the three dashes in the upper right corner of this view

If you want to add or fix something in this document, send a pull request or file an issue.

awesome-low-level-programming-languages

A curated list of low level programming languages primarily aimed at OS and game programming.

Excluded are languages relying on managed run-times, GC, JITs, green threads, etc. (For less exclusionary lists check ChessMax or Wikipedia.)

ATS

#include "share/atspre_staload.hats"
#include "share/atspre_staload_libats_ML.hats"

implement
main0() = println! ("Hello, world!")
fun fibc (n: int) : int = let
  fun loop(n: int, f0: int, f1: int): int =
    if n > 0 then loop(n-1, f1, f0+f1) else f0
  end of [loop]
in
  loop(n, 0, 1)
end // end of [fibc]

Ada

with Ada.Text_IO;

procedure Hello_World is
begin
   Ada.Text_IO.Put_Line ("Hello World");
end Hello_World;
function fibonacci(n : in integer) return integer is
 f1, f2, fib : integer;
 begin
    f1 := 0;
    f2 := 1;
    for i in 1..n loop
       fib := f1 + f2;
       f1 := f2;
       f2 := fib;
    end loop;
    return fib;
 end fibonacci;

Alumina

fn main() {
    println!("Hello, world!");
}

Beef

using System;

namespace Hello
{
    class Program
    {
        static void Main()
        {
            Console.WriteLine("Hello, world!");
        }
    }
}
N/A

C

  • main: N/A
  • repo: N/A
  • documentation:
  • meta-programming: pre-processor
  • error-handling: magic return values by covention
  • backends: LLVM, gcc, numerous others
  • major projects using the language: numerous
  • syntax: curly braces, type to the left of identifier
  • highlights:
    • ubiquitous
    • often used as a backend
    • no namespaces
    • array to pointer auto conversion
    • no defer (or RAII) mechanism
    • lots of undefined / implementation defined behavior
  • pldb
#include <stdio.h>

int main() {
  printf("Hello World!");
}
int fib(int n) {
    int a = 0;
    int b = 1;
    for (int i = 0; i < n; i++) {
       int c = a + b;
       a = b;
       b = c;
    }
    return a;
}

C++

#include <iostream>

int main() {
  std::cout << "Hello World!" << std::endl;
}

int fib(int n) {
    int a = 0;
    int b = 1;
    for (int i = 0; i < n; i++) {
       const int c = a + b;
       a = b;
       b = c;
    }
    return a;
}

C2

module hello_world;

import stdio as io;

public fn i32 main(i32 argc, char** argv) {
    io.printf("Hello World!\n");
    return 0;
}
fn u32 fib(u32 n) {
    return n <= 2 ? 1 : fib(n - 1) +  fib(n - 2);
}

C3

module hello_world;

import std::io;

fn void main()
{
    io::printn("Hello, World!");
}
fn int fib(int n) {
    int a = 0;
    int b = 1;
    for (int i = 0; i < n; i++) {
       int c = a + b;
       a = b;
       b = c;
    }
    return a;
}

Carp

(println "hello world")
N/A

Cone

import stdio

fn main():
  print <- "Hello world!"
fn fib(n i64) i64:
  mut prior i64 = 0
  mut result i64 = 1
  while n-- > 0:
    prior, result = result, prior + result
  result

Crystal

puts "Hello World"
def fib(n)
  a = 0
  b = 1
  n.times do
    a += b
    a, b = b, a
  end
  a
end

CSpydr

import "std.csp";

fn main(): i32 {
    std::io::puts("Hello, World!");
    <- 0;
}
fn fib(n: i32): i32 {
    let a = 0;
    let b = 1;
    for 0 .. n {
        a + b |> (a = b, b = $);
    }
    <- a;
}

D

import std.stdio;

void main() {
    writeln("Hello, World!");
}
N/A

Forth

  • main: N/A
  • repo: N/A
  • documentation:
  • implementation-language: C, assembler,
  • meta-programming: N/A
  • backends: Custom
  • major projects using the language: N/A
  • syntax: unique
  • highlights:
  • concatenative programming style
  • many different flavors
  • very easy to implement
: HELLO ."Hello World " ;

: FIB ( x -- y ) RECURSIVE
	DUP 2 > IF DUP  1- RECURSE
		   SWAP 2- RECURSE +  EXIT
	     ENDIF
	DROP 1 ;

Hare

use fmt;

export fn main() void = {
    fmt::println("Hello, world!")!;
};
N/A

Hylo

(formerly: Val) (Needs more work - pull requests welcome)

Jai

N/A
N/A

Kit

function main() {
    printf("%s\n", "hello world!");
}
N/A

Lateralus

  • main: https://github.com/bad-antics/lateralus-lang
  • repo: https://github.com/bad-antics/lateralus-lang
  • implementation-language: Python, C
  • meta-programming: decorators, compile-time evaluation
  • backends: VM (register-based bytecode), C
  • major projects using the language: N/A
  • syntax: Rust/Swift inspired, curly brace, pipeline operators
  • memory management: ownership model with borrow semantics
  • highlights:
    • pipeline-native: first-class |> pipe operator for data flow
    • bare-metal OS support
    • custom assembly format (LTasm) with 80+ opcodes
    • full LSP with VS Code extension (14 providers)
    • async/await concurrency
    • pattern matching, module system, generics
module examples.hello

import io

pub fn main() {
    let nums = [1, 2, 3] |> map(fn(x) x * x)
    io.println("Hello from Lateralus!")
}

pub struct Point { x: float  y: float }

impl Point {
    pub fn new(x: float, y: float) -> Point {
        return Point { x: x, y: y }
    }
}
; Hello World in Lateralus Assembly
.section code
.global _start

_start:
    PUSH_STR   "Hello, World!"
    PRINTLN
    PUSH_IMM   0
    HALT

Lobster

print "hello world"
def fibonacci(n:int):
  var a = 0
  var b = 1
  for(n):
    let t = b
    b += a
    a = t
  return a

Loment

  • main: https://fujojtop.github.io/loment-site/
  • repo: https://github.com/FujoJTOP/loment
  • documentation:
  • discussion: https://discord.gg/rGw7NRNU
  • implementation-language: Loment (the compiler driver self-hosts at run time; a Python reference implementation sits beside it until that finishes)
  • meta-programming: compile-time const, generics, and a "form object" the build emits per unit and two independent validators check
  • backends: LLVM IR, linked by the repository's own linker (lomelf) — no clang needed to build a program
  • memory management: the program picks a reclamation tier with choose — compile-time promotion to the stack, definite-lifetime free, block epochs, or a mark-sweep collector (with an adaptive, generational variant). Default is explicit alloc/free.
  • major projects using the language: N/A (the toolchain itself)
  • syntax: Rust-flavored; the same program is also accepted with C, C++, Java, C#, Go or Python spelling
  • highlights:
    • native x86-64: Linux ELF, Windows PE, or a freestanding object for bare metal
    • sealed by default — no runtime, no libc, no undefined symbols; a hello-world is an 8 KB static executable
    • every subsystem is a switch the program states (sealed/hosted, std/no_std, runtime/no_runtime, vm/no_vm, and the reclamation tier), set at most once in the root unit and recorded in the build
    • capability domains: capability blk : disk[0..4] declares a range, guard blk(i); checks the index — at compile time for a literal, otherwise at run time
    • installing and running needs no Python, no clang and no WSL; the package is native binaries plus the standard library
module hello

fn _start() {
    let s: str = "hello from Loment\n";
    syscall4(1, 1, str_ptr(s) as u64, str_len(s) as u64);
    syscall4(60, 0, 0, 0);
}
fn fib(n: u32) -> u32 {
    if n < 2 {
        return n;
    }
    return fib(n - 1) + fib(n - 2);
}

fn _start() {
    syscall4(60, fib(20) as u64, 0, 0);
}

Mach

  • main: https://machlang.org
  • repo: https://github.com/briar-systems/mach
  • documentation: https://machlang.org/docs/
  • discussion:
  • implementation-language: Mach (self-hosted)
  • meta-programming: generics, comptime ($if conditional compilation, comptime parameters, variadic packs, type reflection)
  • backends: native x86_64, aarch64, riscv64 and SPIR-V code generators with its own ELF, Mach-O and COFF linker
  • major projects using the language: the compiler itself, hedge (web server), boom (game engine)
  • syntax: C-like with curly braces, types after names, no type inference
  • memory management: manual, allocators are explicit values
  • highlights:
    • no hidden control flow: no exceptions, destructors or operator overloading
    • tagged unions with lexically guarded payload access
    • fin blocks for deferred cleanup
    • secret types (^T) checked for constant-time use
    • inline assembly and GPU shaders written in Mach
    • one toolchain builds, links, tests, formats, vendors dependencies and cross-compiles
use std.print;
use std.runtime;

#[symbol("main")]
fun main(argc: i64, argv: **u8) i64 {
    print.println("hello world");
    ret 0;
}
fun fibonacci(n: u64) u64 {
    var a: u64 = 0;
    var b: u64 = 1;
    var i: u64 = 0;
    for (i < n) {
        val t: u64 = b;
        b = a + b;
        a = t;
        i = i + 1;
    }
    ret a;
}

Modula-2

MODULE Hello;
FROM STextIO IMPORT WriteString;
BEGIN
  WriteString("Hello World!")
END Hello.
PROCEDURE fib(n : INTEGER) : INTEGER;
VAR
    a, b, c : INTEGER;
BEGIN
    a := 0;
    b := 1;

    WHILE n > 0 DO
        c := a + b;
        a := b;
        b := c;
        DEC(n)
    END;

    RETURN a
END fib;

Nim

echo "Hello World"
proc fib(n: uint64): uint64 =
    if n <= 1: return n
    return fib(n - 1) + fib(n - 2)

Oberon

MODULE Hello;
         IMPORT Oberon, Texts;
  VAR W: Texts.Writer;

  PROCEDURE World*;
  BEGIN
    Texts.WriteString(W, "Hello World!");
    Texts.WriteLn(W);
    Texts.Append(Oberon.Log, W.buf);
  END World;

BEGIN
  Texts.OpenWriter(W);
END Hello.
PROCEDURE fib(VAR n: INTEGER) : INTEGER;
  VAR
    a, b, c, i : INTEGER;
  BEGIN
    a := 0;
    b := 1;
    FOR i := 1 TO n DO
      c := a + b;
      a := b
      b := c
    END;
    RETURN a;
END fib;

Odin

package main

import "core:fmt"

main :: proc() {
  fmt.println("Hello World!")
}

fibonacci :: proc(n: int) -> int {
  switch {
  case n < 1:
    return 0
  case n == 1:
    return 1
  }
  return fibonacci(n-1) + fibonacci(n-2)
}

Pascal (FreePascal)

program Hello;
begin
  writeln ('Hello, world.');
  readln;
end.
function fibonacci(const n: integer): integer;
var
  a, b, c, i: integer;
begin
  a := 0;
  b := 1;
  for i := 1 to n do
  begin
    c := a + b;
    a := b;
    b := c;
  end;
  fibonacci := a
end;

Rust

  • main: https://www.rust-lang.org/
  • repo: https://github.com/rust-lang
  • documentation:
  • implementation-language: Rust
  • meta-programming:
    • hygienic macros
    • generics/traits
    • comptime
  • backends: LLVM
  • major projects using the language: numerous (including large parts of Firefox)
  • syntax: curly braces, type to the right of identifier
  • highlights:
    • memory safety focus (ownership semantics)
    • immutable by default
    • bare metal programming via no_std environment
    • steep learning curve
    • large language
    • slow compiles
  • pldb
fn main() {
    println!("Hello World!");
}
fn fib(n: u8) -> u64 {
  let mut prev: u64 = 0;
  let mut curr: u64 = 1;
  for _ in 1..n {
      let next = prev + curr;
      prev = curr;
      curr = next;
  }
  curr
}

SEMAPRAX

module examples.meaning;

@id("app.main")
fn main() -> i64
    ensures result == 42
{
    42
}
@id("math.fib")
fn fib(n: i64) -> i64
    requires n >= 0
{
    let mut remaining = n;
    let mut previous = 0;
    let mut current = 1;
    while remaining > 0 {
        let next = previous + current;
        previous = current;
        current = next;
        remaining = remaining - 1;
        remaining > 0
    }
    previous
}

Scopes

print "hello world"

fn fib (n)
  loop (a b = 0 1)
    if (b < n)
      repeat b (a + b)
    else
      break b

Swift

  • main: https://swift.org/
  • repo: https://github.com/SwiftLang
  • documentation:
  • discussion:
  • implementation-language: C++ and Swift
  • error-handling: dedicated syntax
  • meta-programming:
    • generics
    • compile-time evaluation
    • macros
  • backends: LLVM, clang, many others
  • major projects using the language: most apps from Apple, server-side frameworks (Vapr, Hummingbird, SwiftNIO), and much more
  • syntax: curly braces, type to the right of identifier and C/C++ like
  • highlights:
    • open source
    • large user base (Apple ecosystem + beyond)
    • ARC (Automatic Reference Counting) for memory management
    • strong type inference
    • protocol-oriented programming
    • cross-platform (Apple platforms, Linux, Windows, embedded)
    • C, C++, Obj-C and Java interoperability
print("Hello, World!")
func fibbonacci(number: Int) -> Int {
	var a = 0
  	var b = 1
  	for _ in 0..<n {
    	let c = a + b
    	a = b
    	b = c
  	}
  	return a
}

V

fn main() {
  println('Hello, World!')
}
fn fn(n int) int {
  mut a := 0
  mut b := 1
  for _ in 0 .. n {
    c := a + b
    a = b
    b = c
  }
  return a
}

Vale

fn main() export {
  println("Hello world!");
}
N/A

Vox

enum u32 stdin  = 0;
enum u32 stdout = 1;
enum u32 stderr = 2;

@extern(syscall, 60)
void exit(i32 error_code);

@extern(syscall, 1)
void sys_write(u32 fd, u8* buf, u64 count);

void write(u32 fd, u8[] data) { sys_write(fd, data.ptr, data.length); }

void main(u8* lpCmdLine, i32 nShowCmd) {
	write(stdout, msg);
	exit(0);
}
N/A

Zig

const std = @import("std");

pub fn main() !void {
    const stdout = std.io.getStdOut().writer();
    try stdout.print("Hello, {s}!\n", .{"world"});
}

fn fibonacci(n: u32) u32 {
   var a : u32 = 0;
   var b : u32 = 1;
   var i : u32 = 0
   while (i < n) : (i += 1) {
      const c : u32 = a + b;
      a = b;
      b = c;
   }
   return a;
}

Not yet summarized (pull requests welcome):

Austral

Cakelisp

Carbon

eC

Helix

Inko

Jiyu

LitaC

Modula-3

Move

Myr

Neat

Nelua

Oak

Ocen

Seed7

Silk

Sparrow

https://github.com/Sparrow-lang/sparrow

Terra

Vala

About

A curated list of low level programming languages (i.e. suitable for OS and game programming)

Topics

Resources

Stars

288 stars

Watchers

14 watching

Forks

Releases

Packages

Contributors