MINK
Native Windows · one .exe · open source

Native Windows programs from small, readable source.

MINK is a programming language that compiles to one .exe. There is no runtime to install and no linker to set up. The compiler is written in Rust with no dependencies.

Version 1.0.5  ·  Windows 10 and newer  ·  Apache License 2.0

  • 0dependencies in the compiler
  • 1.exe per program
  • 27standard library modules
  • 0admin rights to install
  • 4.1 MBsetup file
What you get

Small tools, clear errors, one format.

One small program

mink build writes a native Windows program itself. No linker, no runtime to ship.

Errors that explain

Every error has a code, a location and an explanation. Try mink explain E-S01.

One format

mink fmt has no settings, and checks it never changes what your program does.

Editor support

A language server and a VS Code extension: errors as you type, completion, hover and rename.

The language

Write it. Run it. Ship one file.

Every example is a real program from the repository, with the output it produced.

hello.mink10 lines
fn square(n: Int) -> Int {
    return n * n;
}

fn main() {
    let mut total = 0;
    for i in 1..6 {
        total = total + square(i);
    }
    rt_print_int(total);
}
PowerShellmink run hello.mink
55
json_configexamples/json_config
// Configuration: read a JSON document and print what it says.
mod json;

fn main() -> Int {
    let arena = rt_alloc(65536);
    let v = json_parse("{\"name\":\"mink\",\"workers\":4,\"debug\":true}", arena);
    if v == 0 {
        rt_print_str("bad json");
        return 1;
    }
    let name = json_as_str(arena, json_obj_get_val(arena, v, 0));
    rt_print_str(name);
    rt_str_free(name);
    rt_print_int(json_as_int(arena, json_obj_get_val(arena, v, 1)));
    let out = json_to_str(arena, v);
    rt_print_str(out);
    rt_str_free(out);
    rt_free(arena);
    return 0;
}
Outputexit 0, no leaks
mink
4
{"name":"mink","workers":4,"debug":true}
hash_and_compressexamples/hash_and_compress
// Security and storage: a SHA-256 digest (printed as hex) and the size of a compressed buffer.
mod hashing;
mod zlib;

fn main() -> Int {
    let hex = hash_sha256("mink");
    rt_print_str(hex);
    rt_str_free(hex);
    let packed = zlib_compress("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 6);
    rt_print_int(rt_str_len(packed));
    rt_str_free(packed);
    return 0;
}
OutputSHA-256 and bytes after compression
7116c83efd0dd269877f09e2
87c25fda77c7fb112ad1a861
e14b9dd4670f36d0
11
web_loopbackexamples/web_loopback
// A tiny web service on this PC: a server thread answers one request, the main thread asks it.
mod network;
mod http;
mod httpserver;
mod threads;

fn serve_one(arg: Ptr<Int>) -> Int {
    let sock = rt_mem_load(arg);
    let got = http_server_serve_default(sock);
    if got.0 == -1 {
        rt_str_free(got.1);
        return 1;
    }
    let copy = http_server_request_copy(got.1);
    let path = http_server_path(copy);
    rt_print_str(path);
    rt_str_free(path);
    http_server_respond_ok(got.0, "hello from mink");
    net_close(got.0);
    return 0;
}

fn main() -> Int {
    net_init();
    let sock = http_server_listen("127.0.0.1", 18080);
    if sock < 0 {
        rt_print_str("listen failed");
        return 1;
    }
    let arg = rt_alloc(8);
    rt_mem_store(arg, sock);
    let t = thread_spawn(serve_one, arg);
    let response = http_client_get_with("127.0.0.1", 18080, "/hello");
    let dup = rt_str_concat(response, "");
    let body = http_body(dup);
    rt_print_int(http_status_code(response));
    rt_print_str(body);
    rt_str_free(body);
    thread_join(t);
    http_server_close(sock);
    rt_free(arg);
    net_cleanup();
    return 0;
}
Outputa server thread and a client, one program
/hello
200
hello from mink
winapi_infobased on examples/winapi_info
fn main() -> Int {
    let user = rt_sys_load_lib("user32.dll");
    if user == 0 {
        rt_print_str("could not load user32");
        return 1;
    }
    let metrics = rt_sys_get_proc(user, "GetSystemMetrics");
    // The argument list must hold at least four words.
    let args = rt_alloc(32);
    rt_mem_store(args, 0);
    let width = rt_sys_call(metrics, args, 1);
    rt_mem_store(args, 1);
    let height = rt_sys_call(metrics, args, 1);
    rt_print_str("screen:");
    rt_print_int(width);
    rt_print_int(height);
    rt_free(args);
    return 0;
}
Outputon the author's PC
screen:
2560
1440

Strings and buffers are freed by hand, and a program that leaves any behind ends with a memory-leak error. That is on purpose, and it is the biggest thing to get used to. See what MINK does not do yet.

Get started

Three steps, about a minute.

Install

Run the setup file, or npm install -g @p4inz-code/mink. It installs for your account and needs no administrator rights.

Write

Make hello.mink in any editor, or right-click, New, MINK Source File once setup has run.

Run or build

mink run hello.mink runs it. mink build hello.mink writes a hello.exe you can give to anyone.

How it compares

Where MINK fits next to Python and C++.

Facts about how you build and ship a program. Speed has its own page: on four small tests MINK ran 6 to 39 times faster than Python and 1.3 to 3.9 times slower than Go. See the numbers and how they were measured.

MINKPythonC++
Shipping a programOne .exeAn interpreter, or a bundling toolThe program plus any libraries it uses
Building itmink build. The compiler writes the .exe itselfNothing to buildA compiler, a linker and usually a build system
MemoryManual, with leaks reported when the program endsAutomaticManual, or smart pointers
ErrorsA code, a location, and mink explainTracebacks while runningCompiler messages, which vary by compiler
LibrariesSmall: 27 standard modulesVery largeVery large
PlatformsWindows 10 and newerMost systemsMost systems
Built for Windows

It feels like part of the system.

Files, icons and menus

.mink files get an icon, right-click Run, Check, Build and Edit, a New menu entry and a preview pane. Double-click only opens an editor. It never runs a file.

A real standard library

Files, JSON, CSV, SQLite, an HTTP client and server, threads, regular expressions, hashing, compression and more. You can also call Windows directly.

Setup that respects you

Installs for your account with no administrator rights, lists itself in Apps & features, keeps several versions side by side, and removes cleanly.

Open and credited

Apache License 2.0. Free for any use, including work. Copies keep the copyright line and the NOTICE file, so the credit stays with its creator.

What's new

MINK 1.0.5, and what comes next.

In 1.0.5

A setup window and a portable zip. Windows file association with icon, right-click Run, Check and Build. mink fmt, mink lsp and a VS Code extension. Icons and version info in built programs. mink upgrade and side-by-side versions. Full changelog.

Planned, not built

Callbacks and a ui module for real Windows windows. An HTML builder. A package registry, mink doc, debug information and real namespaces. Nothing here has a date. Read the plan.

Twelve small programs written in MINK, from a web server to a terminal game, are on the Examples page. They found and fixed bugs in the standard library, SQL engine and runtime along the way. Those fixes ship in 1.0.6.

Download

MINK 1.0.5 for Windows.

Windows 10 and newer, 64-bit. Pick one way to install.

Setup file

The easiest way. A setup window with options, in your own account.

SHA-256
3a1857275bfb2690fbbc5f84fa4f962945b9f13cb196bf5b663474f75faa2a7e
Download setup  ·  4.1 MB

Portable zip

Unzip anywhere and run. Nothing is written to your account.

SHA-256
0c351b63b2d67ef584aaba6fd91270ae0d5d38b37e7b308df9f22681a55e4f93
Download zip  ·  2.1 MB

npm

If you already use Node.js and npm.

npm install -g @p4inz-code/mink
View on npm

The files are not code-signed. Windows SmartScreen may ask you to confirm before it runs the setup file. To check a download, compare its hash: Get-FileHash .\mink-Setup-1.0.5.exe -Algorithm SHA256

All downloads, how to verify, and past releases

All releases and notes: github.com/p4inz-code/mink/releases

What MINK does not do yet

Honest limits.

  • Windows only. Windows 10 and newer. There is no Linux, macOS, browser or mobile target.
  • Young. Version 1.0.5. Expect rough edges, and tell us about them.
  • You manage memory. Strings and buffers are freed by hand, and leaks are reported when a program ends.
  • Speed is measured only on small programs. Four tests so far, on one PC, against Python, Go and Rust. There was no C or C++ compiler to compare with. See Benchmarks.
  • VS Code only. Other editors can use the language server directly. The extension is not on the Marketplace yet.
  • Unsigned.

The full list is in KNOWN_LIMITATIONS.md.

Made by

One person, building in the open.

MINK is made by Atharva Patil at P4inz Interactive Labs, alongside other tools for artists, studios and developers: OutlineDesk, Kanvaz, Ropework and Nexus. The work, the plans and the mistakes are all in the repository.

Need a hand?

Ask, report, or contribute.

Found a bug or something confusing? Open an issue with your MINK version and the smallest program that shows it.