Skip to content

Naren3333/opl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

OPL (One Piece Language) is a custom programming language with a bytecode VM, garbage collection, debugger integration, and VSCode tooling.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors