Skip to main content

OPL (One Piece Language)

OPL is a lightweight programming language with a readable pirate-flavored syntax and a real runtime behind it. It includes an AST interpreter, a stack-based bytecode VM, compiled .oplb files, closures, models, collections, modules, a standard library, CLI tooling, a debugger, LSP support, and a VSCode extension.

OPL source files use the .opl extension.

Features

  • Pirate syntax frontend with clean core OPL underneath
  • AST interpreter for reference execution
  • Stack-based VM with compiled bytecode support
  • .oplb build and inspect workflow
  • First-class functions and lexical closures
  • Models, methods, properties, and captain binding
  • Lists, maps, indexing, for-in loops, and collection built-ins
  • Algorithm-practice collections: crew sets, chest stacks, fleet queues, and Python-style heapq
  • Pirate control flow: sail, otherwise, abandon, sailon, deliver, yeh, nah, and void
  • Modules/imports and first-party standard library
  • CLI, REPL, formatter, diagnostics, and debugger
  • LSP-powered VSCode support with hover, definitions, symbols, completions, diagnostics, and DAP debugging

Quickstart

Install OPL:

pip install oplang

Create hello.opl:

bounty x = 5
say x + 1

Run it:

opl run hello.opl

Expected output:

6

CLI

opl --version
opl run file.opl
opl check file.opl
opl format file.opl
opl repl

Run on the VM:

opl run file.opl --vm

Build bytecode:

opl build file.opl
opl run file.oplb --vm
opl inspect file.oplb

Debug

Launch the VM debugger:

opl debug file.opl

Useful debugger commands:

step
continue
stack
locals
inspect name
quit

VSCode

The VSCode extension lives in vscode-opl/.

It provides:

  • .opl file association
  • Syntax highlighting
  • Snippets
  • Language configuration
  • LSP diagnostics, hover, definitions, document symbols, workspace symbols, and completions
  • DAP debugger integration

For local extension development:

cd vscode-opl
npm install

Then open the extension folder in VSCode and run the extension host.

Marketplace packaging:

npm install -g @vscode/vsce
vsce package

Publishing:

vsce publish

Documentation

  • docs/quickstart.md
  • docs/language-basics.md
  • docs/standard-library.md
  • docs/examples.md

Algorithm Practice

OPLL 1.1 includes the data structures and control flow needed to practice graph, heap, and dynamic-programming patterns locally. Run the included examples in either execution mode:

opl run opl/examples/algorithms.opl
opl run opl/examples/algorithms.opl --vm

The algorithm vocabulary keeps the theme focused and the APIs familiar:

bounty queue = fleet()
bounty visited = crew()

queue.push(start)
visited.add(start)

sail not queue.empty():
    bounty node = queue.pop()
    if not visited.has(node):
        visited.add(node)

Website And Playground

The public website and documentation live in docs/ for GitHub Pages.

The landing page is:

docs/index.html

The static playground is Pages-compatible. It lets users edit and copy OPL examples, then run them locally with:

python -m pip install oplang
opl run app.opl

GitHub Pages Deployment

To publish the website from this repository:

  1. Open the GitHub repository settings.
  2. Go to Pages.
  3. Set the source to Deploy from a branch.
  4. Select the default branch.
  5. Set the folder to /docs.
  6. Save and wait for GitHub Pages to publish.

All website assets use relative paths so the site can be served from a repository Pages URL.

PyPI Release

Build distributions:

python -m build

This creates:

dist/oplang-*.whl
dist/oplang-*.tar.gz

Publish manually with Twine:

python -m twine upload dist/*

Do not publish until the release artifacts have been inspected and tested.

Metadata

Release files for oplang 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oplang 1.1.0
File Size Uploaded Provenance Actions
oplang-1.1.0.tar.gz 45.6 kB Without provenance Details for oplang-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oplang 1.1.0
File Interpreter ABI Platform Actions
oplang-1.1.0-py3-none-any.whl Python 3 none any Details for oplang-1.1.0-py3-none-any.whl

Total release size: 97.3 kB

Release files / oplang-1.1.0.tar.gz

Download URL oplang-1.1.0.tar.gz
Size 45.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bfed3359415abf58dc04a72fe5f5e4fb2fb82bc69741245748cff439de6688f0
BLAKE2b-256 checksum
How to use checksums
ae077ce96f8d7d8a1a795932ee6c01ceae9955ee4e40cee2e4550e66b8a66102
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / oplang-1.1.0-py3-none-any.whl

Download URL oplang-1.1.0-py3-none-any.whl
Size 51.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7d44171eb865b7aa7206504a09bde17880d5c791f62837efa58c7fb2c6cdcbd
BLAKE2b-256 checksum
How to use checksums
a4ff9378cfe12652f15ce7013036ec73b3f03653b9002e7d0aadf879b438df49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for oplang 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page