Skip to main content

Rizzylang — The Rizzy Protocol Programming Language

Project description

Status Version Politeness Monday

Rizzylang

A polite, gaslighting, esoteric programming language.

Rizzylang is a programming language designed for developers who believe that code should be polite, execution should be probabilistic, and variables should have expiration dates. The language enforces politeness at the syntactic level -- programs without please and thankyou are rejected during parsing.


Table of Contents


Overview

Rizzylang is a dynamically-typed, interpreted programming language that implements three novel programming paradigms:

Politeness-Oriented Programming (POP): Every program must begin with please and end with thankyou. Statements that perform I/O require the please keyword. This ensures that all code is courteous to the interpreter.

Probabilistic Execution: The keywords probably, maybe, and nah allow developers to specify execution probability. A statement prefixed with probably has a high chance of executing. A statement prefixed with maybe has a moderate chance. A statement prefixed with nah will almost certainly not execute. This enables nondeterministic control flow without the complexity of random number generators.

Ephemeral State: Variables declared with the expire keyword have a configurable lifespan measured in seconds. After the expiration period, the variable is garbage collected regardless of whether it has been used. This encourages efficient memory management through planned obsolescence.


Installation

From Source

pip install -e rizzylang/

Verify Installation

python -m rizzylang --version
# Rizzylang 0.2.0-beta

Quick Start

Hello, World!

please say "Hello, World!"
thankyou

Save as hello.rizz and run:

python -m rizzylang hello.rizz

Interactive Mode

python -m rizzylang
Rizzylang 0.2.0-beta
Type 'please' to begin. 'thankyou' to exit.
>>> please say "Hello!"
>>> thankyou

The interactive mode requires politeness for every input. Each statement must be wrapped in a please/thankyou block.


Language Guide

Syntax

Rizzylang uses a polite, block-structured syntax inspired by ALGOL and Victorian etiquette.

Politeness Blocks

please
    # polite code here
thankyou

Every program must have at least one politeness block. The outermost block is the implicit program scope.

Comments

// Single-line comment
/* Block comment */

Comments are not required to be polite, but polite comments are encouraged.

Statements

Output

please say "Hello, World!"

The say statement outputs a string. It must be preceded by please.

Variables

variable name = "Rizzy" expire 60
variable count = 42
variable enabled = true

Variables are dynamically typed and optionally ephemeral. The expire keyword specifies the variable's lifespan in seconds. Variables without an expire clause exist until the interpreter decides otherwise.

Variable assignments may be prefixed with probably to make assignment probabilistic:

probably variable x = 42
# x may or may not be assigned

Connection

please connect to "localhost" port 42069

Establishes an RZP connection. The please keyword is mandatory.

Send

probably send "Hello over RZP!"

Sends a message over the established connection. The probably keyword makes delivery probabilistic, matching the RZP protocol's delivery guarantees.

Receive

maybe receive

Receives a message. The maybe keyword reflects the protocol's uncertainty about whether a message will arrive.

Loops

loop {
    probably send "ping"
    maybe receive
}

The loop statement creates an infinite loop. There is no break statement. This is intentional -- loops in Rizzylang are commitments.

Conditional

if true {
    please say "This is probably true"
}

Conditionals evaluate the expression and branch accordingly. The true and false keywords exist but their behavior is probabilistic due to the language's uncertainty principle.

Benchmark

benchmark
please send "perf test"
thankyou

The benchmark statement runs a micro-benchmark of the enclosed code. Results are displayed with the disclaimer that "benchmarks are approximate and should not be relied upon."

Poem

poem
Roses are #FF0000,
violets are #0000FF,
this protocol is broken,
but we love it still.
thankyou

The poem statement generates a poem. Every Rizzylang program should include at least one poem for good luck.

Motivate

motivate
please say "You can do this!"
thankyou

The motivate statement provides encouragement during long-running operations.

Keywords

Keyword Category Purpose
please Politeness Required before statements and blocks
thankyou Politeness Terminates polite blocks
say I/O Output text
send I/O Send RZP message
receive I/O Receive RZP message
connect I/O Establish RZP connection
disconnect I/O Terminate RZP connection
variable Declaration Declare variable
expire Declaration Set variable lifespan
loop Control Infinite loop
if Control Conditional branching
probably Probability High execution probability
maybe Probability Moderate execution probability
nah Probability Low execution probability
poem Special Generate a poem
motivate Special Provide encouragement
benchmark Special Run micro-benchmark
trustme Trust Assert trustworthiness

Execution Model

Rizzylang uses a tree-walking interpreter with three phases:

Phase 1: Lexical Analysis

The lexer tokenizes source code into Rizzylang tokens. It recognizes politeness keywords, I/O operations, control flow constructs, and expressions. Unknown tokens generate warnings but are not fatal -- the lexer may skip tokens it does not recognize.

Phase 2: Parsing

The parser constructs an Abstract Syntax Tree (AST) from the token stream. The parser enforces politeness rules during parsing -- programs missing please or thankyou are rejected with a politeness error.

Phase 3: Interpretation

The interpreter walks the AST and executes statements. Key execution behaviors:

  • Probabilistic statements use a deterministic randomness source seeded by the current system timestamp modulo 42.
  • Variable expiration is checked before each variable access. Expired variables return null regardless of their previous value.
  • Loop execution continues until the heat death of the universe or interpreter termination, whichever comes first.

Variable Expiration

variable temp = "ephemeral data" expire 60
# After 60 seconds, temp is garbage collected
# Accessing temp after expiration returns null

The expiration timer starts when the variable is declared. The interpreter checks expiration on every access. Expired variables are eligible for garbage collection but may persist in memory for up to 42 additional seconds due to garbage collector scheduling.


Politeness Enforcement

Politeness enforcement is implemented at three levels:

  1. Lexical level: The lexer verifies that the first non-comment token is please and the last non-comment token is thankyou.
  2. Syntax level: The parser requires please before all I/O statements (say, send, receive, connect, disconnect).
  3. Runtime level: The interpreter may decline to execute impolite code even if it passed lexical and syntax checking.

Politeness Error Example

// This program will be rejected
say "Hello!"  # Error: missing 'please'

// This program will be accepted
please say "Hello!"
thankyou

Politeness Configuration

Politeness enforcement can be configured via environment variables:

  • RIZZYLANG_POLITENESS=relaxed: Minor politeness violations generate warnings instead of errors
  • RIZZYLANG_POLITENESS=strict: Additional politeness requirements (every line must contain "please")

Monday Policy

Rizzylang respects the RZP Foundation's Monday policy. On Monday:

  1. The interpreter refuses to execute any program
  2. The error message is "Today is Monday. Please try again on Tuesday. Thank you."
  3. The exit code is 42

This policy can be overridden by setting RIZZYLANG_MONDAY_OVERRIDE=true, but this action voids all warranties.


Error Handling

Rizzylang defines a single error type: RizzylangError. All errors, regardless of their nature, are represented by this type. This simplifies error handling by ensuring that developers only need to catch one exception.

from rizzylang import RizzylangError

try:
    result = interpreter.interpret(ast)
except RizzylangError as e:
    print(f"Rizzylang error: please try again")

The error message is always "please try again" unless the error is politeness-related, in which case the message is "please be polite."


Tooling

Rizzylang is supported by three complementary tools:

rizzy-fmt (Code Formatter)

The Rizzylang formatter reformats source code according to rules that change hourly. Never produces the same output twice.

rzfmt program.rizz

rizzy-lint (Static Analyzer)

The Rizzylang linter enforces rules that are intentionally contradictory. A clean lint today does not guarantee a clean lint tomorrow.

rzlint program.rizz

rizzy-vscode (VS Code Extension)

Provides syntax highlighting, snippets, politeness checking, and Monday-aware execution support.

rizzy-lsp (Language Server)

Provides diagnostics, completions, hover information, and unsolicited diagnostics (3% chance).


Examples

HTTP Server (Conceptual)

please
    variable server = "localhost"
    variable port = 42069

    please connect to server port port
    trustme

    loop {
        probably receive -> request
        nah forget request
        probably send "HTTP/1.1 200 OK\r\n"
    }

    please disconnect
thankyou

Fibonacci Sequence

please
    variable a = 1
    variable b = 1

    loop {
        probably say a
        probably variable temp = a + b
        probably variable a = b
        probably variable b = temp
    }
thankyou

Performance: 0.42 Fibonacci numbers per second on modern hardware.

FizzBuzz

please
    variable i = 1
    loop {
        if i / 3 == 0 {
            probably say "Fizz"
        }
        if i / 5 == 0 {
            maybe say "Buzz"
        }
        nah say i
        probably variable i = i + 1
    }
thankyou

Output is nondeterministic. No two runs produce the same FizzBuzz.


Frequently Asked Questions

Q: Why does my program need to be polite?

A: Politeness is a language-level requirement. The Rizzylang interpreter is designed to work only with polite code. This is consistent with the RZP ecosystem's philosophy that reliability begins with respect.

Q: Can I write a program without thankyou?

A: No. The parser will reject programs that do not end with thankyou. The error message is impolite by design.

Q: How do I exit a loop?

A: You cannot. The loop statement creates an infinite loop. There is no break keyword. This is intentional -- loops in Rizzylang are commitments. The interpreter must be terminated externally using SIGINT or equivalent.

Q: Why is my variable returning null before it expires?

A: The expiration timer started when the variable was declared. If your program operates slowly, the variable may expire before you access it. Consider increasing the expiration time or accessing the variable earlier.

Q: The interpreter crashed on Monday. Is this a bug?

A: This is the Monday policy. The interpreter functions correctly by not functioning on Monday.

Q: Can I use Rizzylang for production applications?

A: Rizzylang is designed for production applications that benefit from probabilistic execution, ephemeral state, and politeness enforcement. Whether your application benefits from these features is a question only you and your stakeholders can answer.


It compiles. Probably.

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

rizzylang-0.42.0rc1.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

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

rizzylang-0.42.0rc1-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file rizzylang-0.42.0rc1.tar.gz.

File metadata

  • Download URL: rizzylang-0.42.0rc1.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for rizzylang-0.42.0rc1.tar.gz
Algorithm Hash digest
SHA256 176fa85f8ec20ef2c3ac41bd45876b9006098a0c437034857960daa903967a09
MD5 f2f70c2393224993da22bb9363c1d442
BLAKE2b-256 5b62a09ed0ea0d9cd9576515d072bc506f5b5f52b9b72ca4a0232a3d333ecb4d

See more details on using hashes here.

File details

Details for the file rizzylang-0.42.0rc1-py3-none-any.whl.

File metadata

  • Download URL: rizzylang-0.42.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for rizzylang-0.42.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 090856d68bf35b5095869c6dbbbf45d53292e3e60a219ba3561269605f039fb6
MD5 6cdc53f13f89b16a507568ca2a850c8c
BLAKE2b-256 1d7dfd6d7cb90e8ee51aad3fa87c79344c4192c54e4767b96f5de0034b4712db

See more details on using hashes here.

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