Skip to main content

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 Print 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 output
  • sigh(prompt) - Read input
  • witcher_speed(text, times) - Repeat string
  • monster_count(array) - Array length
  • add_to_bestiary(array, value) - Append to array
  • hunter_instinct(value) - Get type info
  • potion_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


Download files

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

Source Distribution

witcherscript-1.3.0.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

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

witcherscript-1.3.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

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

Hashes for witcherscript-1.3.0.tar.gz
Algorithm Hash digest
SHA256 b0f0d919e6868ee58f90ecc4e48b37942586b9a5f5771a0d81369fbec29303a6
MD5 2c2e2aa3f4d6d5b32eb8f69e7ebf292e
BLAKE2b-256 4cc3f41da1ff2972f485ad3d6dd22871e48d5f7e5446bb550173c56e5430e397

See more details on using hashes here.

Provenance

The following attestation bundles were made for witcherscript-1.3.0.tar.gz:

Publisher: publish-witcherscript.yml on rwnicholas/WitcherScript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for witcherscript-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d46f2347b10ff2e9836578de2a5fa9d26582bdd166782ea1bbc4d0f9932e342
MD5 510149244f91de75be83330b0097f2d5
BLAKE2b-256 5cb0dc39047d2f66d29553fac4ad3768cf3a3760caaf735698d1e3ad163a5192

See more details on using hashes here.

Provenance

The following attestation bundles were made for witcherscript-1.3.0-py3-none-any.whl:

Publisher: publish-witcherscript.yml on rwnicholas/WitcherScript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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