Skip to main content

Red Rope

Red Rope is a tiny capability-based language where syntax and runtime power are loaded explicitly from binary .kn modules, also called knouts.

This repository contains a dependency-free Python reference implementation for the 0.1.0 draft language spec. See SPEC.md for the current behavior.

Quick Start

Build the example knouts:

python -m redrope.tools.build_examples

Run the example program:

python -m redrope examples/hello.rr

After installing the package, the same program can be run with:

redrope examples/hello.rr

Expected output:

Hello from Red Rope

Example Program

load ../modules/printing.kn
load ../modules/pythonstyle.kn

print("Hello from Red Rope")

Nothing except load exists before modules are loaded. Runtime modules provide capabilities such as print; syntax modules provide statement forms such as print({x}).

Syntax modules merge when loaded. Newer syntax rules are checked first, so a later module can override a matching shape while earlier non-conflicting rules remain available.

Writing Knouts

Human-authored modules use .knsrc and compile to binary .kn with knc:

python -m redrope.knc module_src/pythonstyle.knsrc -o modules/pythonstyle.kn

After installing the package:

knc module_src/pythonstyle.knsrc -o modules/pythonstyle.kn

Example runtime module:

module printing runtime
metadata version=1.0
export print function
native print rr_print_stdout

Example syntax module:

module pythonstyle syntax
metadata version=1.0
rule print({x}) -> call print x

Rule actions may use shorthand calls, where identifiers are captures:

rule display {x} -> call print x

They may also use explicit VM actions separated by semicolons:

rule banner {x} -> load_const ">>> "; load_capture x; concat; invoke print 1

Project Layout

  • redrope/: reference interpreter, module loader, tokenizer, VM, and CLI.
  • redrope/knc.py: compiles .knsrc module source files to binary .kn knouts.
  • redrope/tools/build_examples.py: compiles the sample .knsrc modules and writes example .rr programs.
  • module_src/: human-readable sample module sources.
  • examples/hello.rr: minimal Red Rope program.
  • examples/merged.rr: demonstrates syntax merging.
  • tests/: unit tests for the core v0.1 behavior.

Current Scope

Implemented:

  • line-oriented .rr execution
  • core comments and load
  • local .kn module loading
  • .kn header and section validation
  • exports, native bindings, compiled syntax, and bytecode actions
  • .knsrc to .kn compiler
  • syntax merging with newest-rule precedence
  • stack-based VM opcodes: LOAD_CONST, LOAD_CAPTURE, CALL, HALT
  • stack/value VM opcodes: LOAD_NUMBER, POP, DUP, SWAP, CONCAT
  • host native binding for rr_print_stdout

Not implemented yet:

  • remote module loading or remote execution; both are reserved for a future trust-policy design
  • signatures/checksums/trust policy
  • unload, namespaces, variables, control flow, or user-defined functions

Metadata

Release files for redrope-lang 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redrope-lang 0.1.0
File Size Uploaded Provenance Actions
redrope_lang-0.1.0.tar.gz 17.3 kB Without provenance Details for redrope_lang-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for redrope-lang 0.1.0
File Interpreter ABI Platform Actions
redrope_lang-0.1.0-py3-none-any.whl Python 3 none any Details for redrope_lang-0.1.0-py3-none-any.whl

Total release size: 34.0 kB

Release files / redrope_lang-0.1.0.tar.gz

Download URL redrope_lang-0.1.0.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fc43a905886d29771b26dd22a503cbc37c39eb6459cb92fd23fc5ffa497d592b
BLAKE2b-256 checksum
How to use checksums
d693ff8968d096adf797f9dc318830808abf65349cceb07f736c7f1b42a1c0ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / redrope_lang-0.1.0-py3-none-any.whl

Download URL redrope_lang-0.1.0-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bfa98c5235119067f2d16afd5d577ed7df3469269d2acff7f86039806ec2aec4
BLAKE2b-256 checksum
How to use checksums
a120aa08687680e5329b8a93b3a9c164c378da4670a2f501b820db9244220224
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for redrope-lang 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page