A programming language inspired by The Witcher 3: Wild Hunt
Project description
WitcherScript
A programming language inspired by The Witcher 3: Wild Hunt, featuring Witcher signs as keywords and game-themed syntax.
Features
- Witcher Signs as Keywords:
igni(if),quen(while),yrden(for),aard(function),axii(switch) - Game-Themed Syntax:
contract(variable),medallion(print),hunt(return),grimoire(import) - Full Language Support: Variables, functions, loops, conditionals, arrays, operators
- No Dependencies: Requires only Python 3.6+
Quick Start
# Interactive mode
python3 witcher_interpreter.py
# Run a file
python3 witcher_interpreter.py example_programs/01_hello_world.witcher
# Or install via pip
pip install witcherscript
Examples
Hello World
medallion("Hail, fellow Witcher!")
Variables & Functions
contract gold = 100
contract reward = 50
medallion(gold + reward) # Output: 150
aard cast_igni(intensity) {
contract damage = 50 * intensity
hunt damage
}
Control Flow
# If statement
igni level >= 50 {
medallion("You are a master!")
} elixir {
medallion("Train more.")
}
# While loop
contract count = 1
quen count <= 5 {
medallion(count)
count = count + 1
}
# For loop
contract monsters = ["Griffin", "Basilisk", "Drowner"]
yrden monster -> monsters {
medallion(monster)
}
Keywords
| Keyword | Purpose | Example |
|---|---|---|
contract |
Variable | contract x = 10 |
mutation |
Constant | mutation MAX = 99 |
medallion |
medallion("text") |
|
igni |
If | igni x > 0 { ... } |
quen |
While | quen x < 10 { ... } |
yrden |
For | yrden item -> items { ... } |
aard |
Function | aard func(x) { ... } |
hunt |
Return | hunt result |
elixir |
Else | igni ... { } elixir { } |
grimoire |
Import | grimoire "lib/module" |
Built-in Functions
medallion(value)- Print outputsigh(prompt)- Read inputwitcher_speed(text, times)- Repeat stringmonster_count(array)- Array lengthadd_to_bestiary(array, value)- Append to arrayhunter_instinct(value)- Get type infopotion_effect(a, b)- Combine values
Data Types
- Numbers:
42,3.14 - Text:
"Geralt of Rivia" - Truth/Falsehood:
truth,falsehood - Bestiary:
["item1", "item2"]
Operators
- Arithmetic:
+,-,*,/,% - Comparison:
==,!=,<,>,<=,>= - Logical:
and,or,not
Project Structure
WitcherScript/
├── witcher_interpreter.py # Main interpreter
├── example_programs/ # Sample programs
│ ├── 01_hello_world.witcher
│ ├── 02_monster_hunt.witcher
│ ├── 03_casting_signs.witcher
│ ├── 04_bestiary.witcher
│ ├── 05_alchemy.witcher
│ ├── 06_quest_system.witcher
│ ├── 07_combat.witcher
│ ├── 08_fibonacci.witcher
│ ├── 09_bubble_sort.witcher
│ ├── 10_grimoire_import.witcher
│ └── 11_multiple_grimoires.witcher
├── lib/ # Library modules
│ ├── monster_helpers.witcher
│ ├── math_utils.witcher
│ └── quicksort.witcher
└── vscode-witcherscript/ # VS Code extension
├── syntaxes/ # Syntax highlighting
├── snippets/ # Code snippets
└── package.json
Try It
python3 witcher_interpreter.py example_programs/02_monster_hunt.witcher
python3 witcher_interpreter.py example_programs/08_fibonacci.witcher
python3 witcher_interpreter.py example_programs/09_bubble_sort.witcher
VS Code Extension
Install the WitcherScript extension for syntax highlighting and snippets:
cd vscode-witcherscript
npm install
vsce package
Then install the .vsix file in VS Code.
License
MIT License - See LICENSE
Inspired By
The Witcher 3: Wild Hunt - CD Projekt Red
Start your witcher journey! 🧙♂️
medallion("May your blade be sharp and your wits sharper!")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file witcherscript-1.3.0.tar.gz.
File metadata
- Download URL: witcherscript-1.3.0.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0f0d919e6868ee58f90ecc4e48b37942586b9a5f5771a0d81369fbec29303a6
|
|
| MD5 |
2c2e2aa3f4d6d5b32eb8f69e7ebf292e
|
|
| BLAKE2b-256 |
4cc3f41da1ff2972f485ad3d6dd22871e48d5f7e5446bb550173c56e5430e397
|
Provenance
The following attestation bundles were made for witcherscript-1.3.0.tar.gz:
Publisher:
publish-witcherscript.yml on rwnicholas/WitcherScript
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
witcherscript-1.3.0.tar.gz -
Subject digest:
b0f0d919e6868ee58f90ecc4e48b37942586b9a5f5771a0d81369fbec29303a6 - Sigstore transparency entry: 834149505
- Sigstore integration time:
-
Permalink:
rwnicholas/WitcherScript@5cdad39ebf6eb2e5e4582d619affd7ffbc3c2607 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/rwnicholas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-witcherscript.yml@5cdad39ebf6eb2e5e4582d619affd7ffbc3c2607 -
Trigger Event:
push
-
Statement type:
File details
Details for the file witcherscript-1.3.0-py3-none-any.whl.
File metadata
- Download URL: witcherscript-1.3.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d46f2347b10ff2e9836578de2a5fa9d26582bdd166782ea1bbc4d0f9932e342
|
|
| MD5 |
510149244f91de75be83330b0097f2d5
|
|
| BLAKE2b-256 |
5cb0dc39047d2f66d29553fac4ad3768cf3a3760caaf735698d1e3ad163a5192
|
Provenance
The following attestation bundles were made for witcherscript-1.3.0-py3-none-any.whl:
Publisher:
publish-witcherscript.yml on rwnicholas/WitcherScript
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
witcherscript-1.3.0-py3-none-any.whl -
Subject digest:
5d46f2347b10ff2e9836578de2a5fa9d26582bdd166782ea1bbc4d0f9932e342 - Sigstore transparency entry: 834149530
- Sigstore integration time:
-
Permalink:
rwnicholas/WitcherScript@5cdad39ebf6eb2e5e4582d619affd7ffbc3c2607 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/rwnicholas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-witcherscript.yml@5cdad39ebf6eb2e5e4582d619affd7ffbc3c2607 -
Trigger Event:
push
-
Statement type: