Skip to main content

One Piece Language: a lightweight scripting language with pirate syntax, a VM, debugger, and editor tooling.

Project description

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
  • 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

Website And Playground

The static website and local playground live in website/.

Start the local playground server:

python website/playground_server.py --port 8787

Open:

http://127.0.0.1:8787

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oplang-1.0.1.tar.gz (38.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oplang-1.0.1-py3-none-any.whl (46.6 kB view details)

Uploaded Python 3

File details

Details for the file oplang-1.0.1.tar.gz.

File metadata

  • Download URL: oplang-1.0.1.tar.gz
  • Upload date:
  • Size: 38.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for oplang-1.0.1.tar.gz
Algorithm Hash digest
SHA256 eecbe1ada57f907ea034676c02ba39bb2c0db8008ed959c4d4cc1a6fb924d6eb
MD5 8b093da2650b53f7e96ff4322435f12e
BLAKE2b-256 d03fac6945b42f0cdb1e3e259849379959078c92d25282614b8648d4c5a9bf43

See more details on using hashes here.

File details

Details for the file oplang-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: oplang-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 46.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for oplang-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 96f61346fd02db46f9291ef5f74a0f39373ceacac34627613b1b4e2c95c01a07
MD5 8995a60ddb5569fa7a9fdd2eab799c94
BLAKE2b-256 e3b52e24c90249cad06a9d07e39e1a18c3e48f658466704beefbe8f563ff79c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page