A scripting engine for Windows

ScriptLangCore

C#-flavoured scripts, compiled ahead of time into one self-contained executable.

Written by Gérôme Guillemin.

Windows 7/8/10/11 x64 NativeAOT, no .NET to install one exe 18.8 MB embeddable DLL, ABI 6 539 test scripts
Download ScriptLangCoreSetup.exe

The installer puts the engine, the launcher and the script folders on the machine, and adds the command to the path.

Other ways in: all releases, source, issues.

What it is

ScriptLangCore runs .slc scripts, a C#-flavoured language with classes, interfaces, generics, structs, tuples, pattern matching, lambdas, coroutines, async/await, exceptions and a full Windows UI toolkit. A script is a text file; the engine lexes it, parses it into an AST, and runs it on one of two engines: a bytecode virtual machine for the bodies it can compile, and a tree walker for every shape it cannot, so a script never depends on what the compiler accepted.

The runtime is NativeAOT: the .NET runtime is inside the executable, so a machine needs Windows and nothing else, with no .NET installation, no Visual C++ redistributable and no Universal CRT redistributable. The engine itself is written in C# and reaches Windows through flat P/Invoke calls rather than through a framework on top.

Support the project

ScriptLangCore is written and maintained by one person. If it saves you time, a donation keeps the work going.

Seven shapes, one engine

The command line: ScriptLangCore.exe

Runs a file, compiles it to a bundle, dumps bytecode, or opens a REPL. 18.8 MB, self-contained.

The engine as a DLL: ScriptLangCore.dll

A C ABI of twenty-four slc_* verbs, plus SQLite extension functions, so a host in C, C#, Python, PowerShell or bash can create a session, run scripts, call into them and read the outcome as JSON. 18.8 MB, 64-bit.

From Python: ctypes

ctypes ships with CPython, so a 64-bit Python drives the engine with nothing to install, and bindings/scriptlangcore.py binds all twenty-four verbs from the ABI manifest so a host writes no signature by hand. bindings/BasicTest.py runs as shipped: it reports the ABI revision, runs a script, calls a function the run declared, and reads the verdict as JSON. 64-bit CPython, no package to add.

From PowerShell: Add-Type

Add-Type and a [DllImport] class are in-box, so Windows PowerShell 5.1 drives the engine with no SDK and no compiler installed, and the same sample runs on PowerShell 7. The one rule is the output callback: it must be a compiled delegate held in a field, because a delegate cast from a scriptblock ends the shell silently at the first print. Windows PowerShell 5.1, nothing to install.

The launcher: ScriptLangCore.Launcher.exe

A 15 KB shortcut onto the engine's own entry point, in C, so a script can be packaged into its own Windows executable with the engine beside it. 15 KB.

Inside SQLite: the same DLL

.load the DLL into any 64-bit sqlite3 and six functions appear, so SQL can evaluate a script expression over a row, fold a set, or map a list. It is also how bash reaches the engine, since bash has no FFI. no extra install.

Inside Excel: the VBA module

64-bit Office calls the DLL directly, because on Windows x64 there is one calling convention and nothing to shim, and assets\language\stdcall\ supplies the rest: a standard module, two class modules and a workbook you can open and run. A macro or a cell formula evaluates an expression, runs a script from text or a file, defines one so its functions call like VBA functions, and reads the verdict as an object with Ok, Status, Code, Message and its position. 32 KB of VBA, no engine copy.

Documentation

Language Reference

The language itself: every keyword, type, operator and built-in namespace, with a worked sample for each.

Syntax, classes and structs, generics, patterns, coroutines, the UI toolkit, COM, SQLite, HTTP, the command line and the REPL, --compile and what a bundle carries. docs/language/index.html

Embedding the engine

How to put the engine inside your own program: the C ABI, the output callback, threads and apartments, verdicts, and the SQLite door.

Session options, calling back into a script, packaging a script into an exe, the launcher, hosts that are not C (Python, PowerShell, bash), what a machine needs, and the limits stated plainly. docs/embed/howto.html

The Bridge

One request document in and one response document out, in both directions: a script serves verbs to its host and calls the host's verbs.

The envelope, the seven rules, the refusals, contract versus transport failures, and all five carriers end to end (C, C#, Python, PowerShell and COM), each with a complete sample and the details that decide whether it works. docs/bridge/howto.html

Networking

Servers and clients from a script: TCP, HTTP, WebSocket, and serving files on the same port without a second listener.

Quick start, the server and the client surfaces, how events are delivered, connection middleware, the engine's own messages, and measured limits. docs/networking/howto.html

MCP tools

Exposing your own tools to an AI client over the Model Context Protocol, written as ordinary script functions.

The command line, writing a tool, the RegisterMcpTool API, argument marshalling, the path sandbox, the middleware pipeline, and the HTTP server middleware. docs/mcp/howto.html

Also in the repository

Why it is built this way

One engine, not two. Bodies the compiler can model run on the bytecode VM; the rest run on the tree walker, and the two are kept at parity by tests that run the same script through both and compare the answers.

No runtime to deploy. NativeAOT means the artifact is the engine. The published DLL and exe import eighteen Windows libraries and nothing else, and the C runtime is linked in.

Checked against the shipped binary. The test corpus (539 scripts) is the instrument, together with the sweeps that compile every script, compare a compiled bundle with the script it came from, and re-run the same script on both engines.