Metadata-Version: 2.4
Name: oplang
Version: 1.1.0
Summary: One Piece Language: a lightweight scripting language with pirate syntax, a VM, debugger, and editor tooling.
Author: OPL Contributors
License-Expression: MIT
Project-URL: Homepage, https://github.com/opl-lang/opl
Project-URL: Documentation, https://github.com/opl-lang/opl/tree/main/docs
Project-URL: Repository, https://github.com/opl-lang/opl
Project-URL: Issues, https://github.com/opl-lang/opl/issues
Keywords: opl,one-piece-language,programming-language,bytecode-vm,language-server
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Compilers
Classifier: Topic :: Software Development :: Interpreters
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# 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:

```powershell
pip install oplang
```

Create `hello.opl`:

```opl
bounty x = 5
say x + 1
```

Run it:

```powershell
opl run hello.opl
```

Expected output:

```text
6
```

## CLI

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

Run on the VM:

```powershell
opl run file.opl --vm
```

Build bytecode:

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

## Debug

Launch the VM debugger:

```powershell
opl debug file.opl
```

Useful debugger commands:

```text
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:

```powershell
cd vscode-opl
npm install
```

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

Marketplace packaging:

```powershell
npm install -g @vscode/vsce
vsce package
```

Publishing:

```powershell
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:

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

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

```opl
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:

```text
docs/index.html
```

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

```powershell
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:

```powershell
python -m build
```

This creates:

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

Publish manually with Twine:

```powershell
python -m twine upload dist/*
```

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