██████╗ ██████╗ ███████╗███╗ ██╗███████╗ ██████╗██████╗ ██╗██████╗ ████████╗ ██╔═══██╗██╔══██╗██╔════╝████╗ ██║██╔════╝██╔════╝██╔══██╗██║██╔══██╗╚══██╔══╝ ██║ ██║██████╔╝█████╗ ██╔██╗ ██║███████╗██║ ██████╔╝██║██████╔╝ ██║ ██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║╚════██║██║ ██╔══██╗██║██╔═══╝ ██║ ╚██████╔╝██║ ███████╗██║ ╚████║███████║╚██████╗██║ ██║██║██║ ██║ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝╚══════╝ ╚═════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝
A small, fast scripting language written in Go, with async/await, classes, and an adaptive native JIT.
OpenScript compiles .os source files to bytecode and runs them on a coroutine-based virtual machine. It ships as a single Go-built interpreter with a standard set of core modules (I/O, files, HTTP, JSON, regex, crypto, sockets, and more) plus bundled libraries.
import { println } from "core:io";
const greeting = "Hello, OpenScript!";
println(greeting);- Familiar, compact syntax:
fnfunctions,classwith inheritance, destructuring, spread, and switch expressions. - Async/await built in: async functions return promises with
->then/->catchchaining. - Coroutine-based VM: bytecode compiler plus a virtual machine written entirely in Go.
- Adaptive native JIT: hot two-argument numeric functions are compiled to machine code after 32 calls. Anything unsupported falls back to the interpreter (details).
- Batteries included:
core:io,core:file,core:json,core:regex,core:http,core:socket,core:crypto,core:math,core:unicode, and more. - Bundled libraries:
lib:argparse,lib:crypto,lib:number,lib:tui. - Helpful errors: uncaught errors and unhandled promise rejections print source locations and stack traces.
- Cross-platform: build for Windows, Linux, and macOS with one script.
import { println } from "core:io";
var add::fn(left, right) {
return left + right;
};
var collect::fn(prefix, values...) {
println(prefix);
println(values); // variadic arguments arrive as an array
};
println(add(2, 3));
collect("items", 2, 3, 4);import { println } from "core:io";
const person = { name: "Ada", role: "engineer" };
const { name, role: jobTitle } = person;
const values = [3, 8, 11];
const doubled = values->map(fn(value, index) {
return value * 2 + index;
});
println(name);
println(jobTitle);
println(doubled);import { println } from "core:io";
var Animal::class {
constructor: fn(name) {
this->name = name;
},
speak: fn() {
return "...";
}
};
var Dog::class(Animal) {
constructor: fn(name) {
super(name);
this->kind = "dog";
},
speak: fn() {
return "woof";
}
};
var pet = Dog("Milo");
println(pet->speak());import { println } from "core:io";
var fetchValue = fn() async {
return 42;
};
var main = fn() async {
var result = await fetchValue();
println(result);
};
main();import { println } from "core:io";
var status = 404;
var label = switch (status) {
200, 201 => "success",
404 => "missing",
default => "other"
};
println(label);import { println } from "core:io";
loop (let i = 0; i < 3; i++) {
println(i);
}
try {
throw "configuration is missing";
} catch (err) {
println(err);
}OpenScript uses
->for member access andloopfor all loops. See the Language Reference for the full syntax, operator table, and module APIs.
- Go 1.25.5 or newer
git clone https://github.com/HolliShake/openscripting.git
cd openscriptingmacOS / Linux
./build.shWindows (PowerShell)
go build -o openscript.exe ./mainOr use build.bat, which also embeds the project icon. Running either build script without arguments creates the executable in the repository root (openscript on macOS/Linux, openscript.exe on Windows).
The build scripts also support:
| Flag | What it does |
|---|---|
--all |
Builds optimized archives under dist/compressed/ for supported Windows, Linux, macOS, BSD, and js/wasm / wasip1/wasm targets. Windows uses ZIP; others use .tar.gz. Each archive has its own <archive>.sha256 checksum file. The JS/WASM archive includes Go's Node.js runtime files. |
--help |
Lists all options. |
Save the following as hello.os:
import { println } from "core:io";
println("Hello, OpenScript!");Then run it:
./openscript -f hello.osOn Windows:
.\openscript.exe -f .\hello.osUse -f or -file to pass a script, and -help to see all command-line options along with the colored banner.
| Resource | What you'll find |
|---|---|
| Language Reference | Syntax, semantics, operators, modules, and runnable API examples. |
tests/ |
Regression programs that double as usage examples. |
lib/ |
Source of the bundled OpenScript libraries. |
The reference is the canonical feature and API guide; this README focuses on building, running, and working on the project.
Core modules (import by name, named exports only):
import { println } from "core:io";| Module | Purpose |
|---|---|
core:io, core:file, core:path |
Console I/O, filesystem, paths |
core:math, core:number, core:unicode |
Numerics and Unicode operations |
core:json, core:regex |
JSON and regular expressions |
core:http, core:socket |
HTTP and loopback TCP |
core:crypto, core:sys, core:error |
Crypto, host system, error handling |
Bundled libraries (loaded from the executable's lib/ directory):
import { isEven } from "lib:number";| Module | Purpose |
|---|---|
lib:argparse |
Command-line argument parsing (ArgumentParser) |
lib:number |
Numeric predicates (isEven, isOdd, isPositive, ...) |
lib:crypto |
CryptoJS-style hashes, HMAC, encoders, PBKDF2, and EvpKDF |
lib:tui |
Terminal colors, prompts, confirmation, and table output |
The tests/ directory contains OpenScript regression programs covering language syntax, module loading, built-ins, async behavior, and runtime error handling. Run a focused script with the built executable:
./openscript.exe -file .\tests\throw-statement.os
./openscript.exe -file .\tests\core-error.osRun other .os files in tests/ the same way.
OpenScript can speed up frequently called, two-argument numeric functions with an adaptive native JIT. Once a function has been called 32 times, eligible code may be compiled for the host processor; anything the JIT does not support keeps running in the bytecode interpreter.
Supported platforms (built with cgo enabled):
| OS | Architectures |
|---|---|
| Windows | amd64, ARM64, 386 |
| Linux | ARMv7 |
| macOS | ARM64 |
Notes:
- Coverage depends on the processor. The backends handle common numeric operations and forward conditional branches; support for bitwise operations, remainder, and shifts varies.
- Loops, relational comparisons, and other unsupported instructions remain interpreted.
- Builds made with
--alldisable cgo, so native JIT support is not included. - On macOS hardened runtime,
MAP_JITmay require thecom.apple.security.cs.allow-jitentitlement. - Windows/ARM32 is not a supported Go target.
openscripting/
├── main/ Go lexer, parser, compiler, bytecode, VM, and native integrations
├── lib/ Bundled OpenScript modules (loaded from the executable's lib/ directory)
├── tests/ Regression scripts and module-loading fixtures
├── docs/ Language and API reference (docs/index.html)
├── build.sh macOS / Linux build and cross-platform archive script
└── build.bat Windows build and cross-platform archive script
Contributions are welcome, whether that's a bug report, a new test, a docs fix, or a library module.
- Fork the repo and create a branch.
- Keep language behavior, regression scripts, and the reference aligned when changing syntax or runtime APIs.
- Build with the supported Go version and run the relevant scripts from
tests/. - Open a pull request describing what changed and why.
Not sure where to start? Add a regression script to tests/, or write an example for the docs.
- Online playground
- Editor support (VS Code extension / Tree-sitter grammar)
-
finallyblocks - More bundled libraries
OpenScript is distributed under the MIT License.
If you find OpenScript interesting, consider giving it a ⭐ on GitHub.