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.
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);
}
PS> mink run hello.mink 55 PS> mink build hello.mink PS> .\hello.exe 55
- 0dependencies in the compiler
- 1.exe per program
- 27standard library modules
- 0admin rights to install
- 4.1 MBsetup file
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.
Write it. Run it. Ship one file.
Every example is a real program from the repository, with the output it produced.
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);
}
55
// 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;
}
mink
4
{"name":"mink","workers":4,"debug":true}// 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;
}
7116c83efd0dd269877f09e2 87c25fda77c7fb112ad1a861 e14b9dd4670f36d0 11
// 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;
}
/hello 200 hello from mink
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;
}
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.
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.
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.
| MINK | Python | C++ | |
|---|---|---|---|
| Shipping a program | One .exe | An interpreter, or a bundling tool | The program plus any libraries it uses |
| Building it | mink build. The compiler writes the .exe itself | Nothing to build | A compiler, a linker and usually a build system |
| Memory | Manual, with leaks reported when the program ends | Automatic | Manual, or smart pointers |
| Errors | A code, a location, and mink explain | Tracebacks while running | Compiler messages, which vary by compiler |
| Libraries | Small: 27 standard modules | Very large | Very large |
| Platforms | Windows 10 and newer | Most systems | Most systems |
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.
Everything is written down.
The documentation lives in the repository next to the code, so it always matches the version you have.
Language guide
Values, functions, ownership, modules and how a program runs.
Standard library
Every module and function, marked with whether it was run or only read.
Error codes
What each error means and what to try.
VS Code and the language server
Install the extension and see what it gives you.
Why MINK exists
The problem it goes after, and what it does not claim.
Governance and versions
How the language changes and how releases are numbered.
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.
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.
3a1857275bfb2690fbbc5f84fa4f962945b9f13cb196bf5b663474f75faa2a7e
Portable zip
Unzip anywhere and run. Nothing is written to your account.
0c351b63b2d67ef584aaba6fd91270ae0d5d38b37e7b308df9f22681a55e4f93
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
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.
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.
Ask, report, or contribute.
Found a bug or something confusing? Open an issue with your MINK version and the smallest program that shows it.