Skip to content
Andrew Matthews edited this page Sep 14, 2025 · 6 revisions

fifthlang

fifthlang logo

status license .NET issues prs last commit

An experimental, open-source programming language that compiles to .NET IL. fifthlang focuses on clear syntax, strong types, and a pragmatic path from ideas to working binaries.

  • Target: .NET (emits IL)
  • Language core: expressions, functions, conditionals, loops, classes, properties
  • Types: int, long, float, double, bool, string, plus user-defined types
  • Status: early alpha (actively evolving)
  • License: GPL-3.0-only

Get going:

Feature highlight: recursive destructuring (beyond C#)

// Destructure Person -> Vitals -> Height/Weight right in the parameter list
calculate_bmi(p: Person {
    name: Name,
    vitals: Vitals{
        age: Age,
        height: Height,
        weight: Weight
        }
    }) : float {
    return weight / (height * height);
}
  • Bind nested properties at the function boundary; no boilerplate in the body
  • This direct parameter-list destructuring is not available in C#
  • See Recursive Destructuring for details

Why fifthlang?

fifthlang is a space to explore language ideas on solid, modern tooling:

  • Modern toolchain: .NET SDK 8; ANTLR-powered parsing; IL code-gen
  • Test-first: rich AST, typing, and end-to-end IL tests guide development
  • Learnable: small, consistent syntax aimed at contributors new and seasoned

A quick taste

Functions and return types:

main(): int {
  return 42;
}

Basic control flow and operators:

foo(x: int): string {
  if (x <= 15) {
    return "child";
  } else {
    return "adult";
  }
}

Variables and arithmetic (unary/binary ops like +, -, *, /, **, %, ==, !=, <, <=, >, >=, &&, ||):

a: int = 5;
a = a * 6;

Property access:

// given p: Person
p.Weight = p.Weight + 1;

Overloads by signature are supported:

foo(i: int): string { return "child"; }
foo(s: string): string { return s; }

Note: The language is evolving quickly; see Language Guide for current details.

What’s inside the repo

  • Parser and AST builder (ANTLR + visitors)
  • Type annotation and (emerging) inference passes
  • IL code generator with validation
  • Comprehensive tests (AST, typing, E2E IL)

Explore the code and issues: https://github.com/aabs/fifthlang

Community and contributions

We welcome contributors of all experience levels. Bring curiosity and a willingness to learn—reviews are kind and constructive. See Contributing.

License

GPL-3.0-only — see the project’s LICENSE.

Clone this wiki locally