onepiece-lang
v1.0.8
Published
π΄ββ οΈ A pirate-themed programming language that compiles to JavaScript
Maintainers
Readme
π Table of Contents
A domain-specific pirate-themed programming language that compiles .onepiece code to JavaScript.
Write code like a pirate. Sail through syntax. Claim your treasure. π¦
π¦ Installation
npm install -g onepiece-langThis installs the onepiece CLI globally.
π Usage
onepiece run <file.onepiece>Compiles a .onepiece file into JavaScript (output.js by default).
Example
onepiece run examples.onepiece
node output.js㪠Language Syntax
π‘ Variable Declaration
temporaryBounty coins = 100 // let
permanentBounty name = "Luffy" // constπ‘ Conditionals
hasHaki (coins > 50)
echoDenDen("Youβre rich!")
noHaki
echoDenDen("Not enough Berries.")
DockAtHarborπ‘ Functions
crewSkill cheer() {
echoDenDen("I will become the Pirate King!")
}
cheer()π‘ Loops
sailThrough (let i = 0; i < 5; i++)
echoDenDen(i)
DockAtHarborπ‘ While Loops
untilRaftel (health > 0)
echoDenDen("Keep sailing!")
health--
DockAtHarborπ‘ Return, Break
claimTreasure "One Piece is real!" // return
abandonShip // breakπ Core Keywords
| OnePiece Keyword | JavaScript Equivalent |
| ----------------- | --------------------- |
| temporaryBounty | let |
| permanentBounty | const |
| hasHaki | if |
| noHaki | else |
| DockAtHarbor | } (block end) |
| crewSkill | function |
| echoDenDen() | console.log() |
| sailThrough | for loop |
| untilRaftel | while loop |
| claimTreasure | return |
| abandonShip | break |
π§ͺ Sample Program
File: examples.onepiece
temporaryBounty bounty = 3000
hasHaki (bounty > 1000)
echoDenDen("High bounty pirate!")
noHaki
echoDenDen("Still a rookie.")
DockAtHarbor
crewSkill attack() {
echoDenDen("Gomu Gomu no Pistol!")
}
attack()Output: output.js
let bounty = 3000;
if (bounty > 1000) {
console.log("High bounty pirate!");
} else {
console.log("Still a rookie.");
}
function attack() {
console.log("Gomu Gomu no Pistol!");
}
attack();βοΈ CLI Reference
| Command | Description |
| ------------------------ | ---------------------------------- |
| onepiece run <file> | Compile .onepiece to output.js |
| onepiece --help | Show usage/help menu |
| onepiece --jolly-roger | Display themed ASCII banner |
π§© Project Structure
.
βββ examples.onepiece // Pirate-style source code
βββ output.js // JS output
βββ compiler.js // Compiler runner
βββ parser.js // Translates lines to JS
βββ lexer.js // Tokenizer
βββ phrases.js // Keyword mappings
βββ postinstall.js // Installation banner
βββ package.json // CLI configurationπ οΈ Developing
To work locally on the compiler:
git clone https://github.com/deepaksarun/onepiece-lang.git
cd onepiece-lang
npm install
npm link # For local CLI testingThen run:
onepiece run examples.onepiece⨠Coming Soon
- π Syntax highlighting for VS Code
- π§ͺ REPL:
onepiece shell - π GitHub Pages documentation
- π¦ Playground: OnePieceLang Web Compiler
π License
MIT β Use across all Grand Line territories. π
Credits & Disclaimer
OnePiece Lang is a fan-made tribute to the legendary anime and manga One Piece.
It is not affiliated with, endorsed by, or officially licensed by Eiichiro Oda, Toei Animation, Shueisha, or any other official rights holders.
- π Original Series by: Eiichiro Oda
- π₯ Anime by: Toei Animation
- π Manga Publisher: Shueisha, Weekly ShΕnen Jump
All characters, settings, and themes are properties of their respective copyright holders.
This project exists solely for educational and entertainment purposes.
No commercial usage is intended.
π΄ββ οΈ From one Straw Hat fan to another: May your code always find LaughTale!
π Created By
Deepak Sarun
π§ "If (Exists): { I build }"
Follow the voyage: github.com/deepaksarun
---
## βοΈ Whatβs Next?
Would you like me to:
- Convert this to live GitHub Pages docs?
- Scaffold a `docs/` folder with markdown for each keyword?
- Create a PirateLang Playground UI (via React or Next.js)?
- Add JSDoc-style inline docs to your codebase?
You're building the pirate equivalent of Python, Captain. Letβs raise the sails π’