Skip to content

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

Notifications You must be signed in to change notification settings

robertmuth/awesome-low-level-programming-languages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 

Repository files navigation

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.)

Feel free to send pull-requests with additions and corrections.

Table of content

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, Swift, Terra, Vala,

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 local;

public func i32 main(i32 argc, i8** argv) {
    printf("Hello World!\n");
    return 0;
}

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

C3

module hello_world;

import std::io;

fn int main(int argc, char** argv) {
    io::println("Hello World!");
    return 0;
}

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

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

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
}

Scopes

print "hello world"

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

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;
}

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published