Catpile — Pythonic DSL → CatWeb JSON compiler
Project description
Catpile
A Pythonic DSL → CatWeb JSON compiler. Write Roblox CatWeb scripts in a clean, readable language - compile to the JSON format CatWeb expects.
Documentation: catpile-docs.vercel.app
.cat source → [Parser] → IR (AST) → [Emitter] → CatWeb JSON
Quick Start
# Install
pip install catpile
# Compile a script
cpile script.cat -o output.json
# Or as module
python3 -m catpile.cli script.cat
# Web service (localhost:8788)
python3 -m catpile.web
Documentation
Online: catpile-docs.vercel.app
Full source is also in the docs/ directory:
| Section | Covers |
|---|---|
| CatLang Reference - docs/lang/ | Syntax, variables, scopes, events, actions, control flow, expressions - everything about the language |
| Compiler - docs/compiler/ | Pipeline, IR, emitter, optimizer, taste system, schema parser - how Catpile works under the hood |
| Tools - docs/tools/ | CLI reference, Web API, VSCode extension guide |
| Guides - docs/guides/ | Installation, quickstart, project system, decompiling, color reference |
| Examples - docs/examples/ | Step-by-step with full explanations and snippets |
CatLang at a Glance
# One-script example
on loaded:
log("Hello World!")
# With variables, conditions, and loops
on pressed("myButton"):
count = 0
repeat(10):
inc(count, 1)
if gte(count, 10):
log("Max reached!")
hide("myButton")
# Multi-script project
script "display":
on loaded:
render_list()
script "data":
fn render_list():
foreach(items):
log("{l_index}: {l_value}")
Key Features
- Indentation-based syntax (Python-like) and bracket syntax (JS-like) via the taste system
- Schema-based compilation - every action knows its slot types (variable, object, any), so braces
{}are handled automatically - Dict literals -
config = {"theme": "dark", "volume": 0.8}compiles to CREATE_TABLE + SET_ENTRY chains - String interpolation -
"Hello {name}!"auto-generates STR_CONCAT - Math expressions - constant folding at compile time, VAR_* chains at runtime for variables
- Multi-return actions -
x, y = getCursor() - Scope-prefixed variables -
l_count→l!count(local),o_board→o!board(object),g_score→g!score(global) - Path-based UI references -
page.buttoninstead of raw global IDs - Auto-indentation (for both tastes), auto-complete, code color preview
- Web editor at
cpile.bouyakhsass.comwith project import/export
Project Structure
catpile/
├── catpile/
│ ├── __init__.py # Package init + scope_var_name()
│ ├── schema.json # 122 actions, 14 events
│ ├── schema_parser.py # CatWeb schema fetcher (from quitism/catlua)
│ ├── mappings.py # Schema loader, aliases, make_action()
│ ├── ir.py # IR types (VarRef, StrLit, MathExpr, …)
│ ├── emitter.py # IR → CatWeb JSON
│ ├── parser.py # Indent taste tokenizer + parser
│ ├── decompiler.py # CatWeb JSON → .cat source + .catui
│ ├── cli.py # CLI entry point
│ ├── web.py # WSGI web API
│ ├── lsp.py # LSP server (stdio)
│ ├── ui.py # UI element linker
│ ├── optimizer.py # -O1/-O2/-O3 optimizations
│ ├── builder.py # Project build system
│ └── tastes/
│ ├── __init__.py # Abstract Taste base class
│ ├── v1.py # "indent" taste
│ ├── bracket.py # "bracket" taste
│ └── registry.py # Taste discovery
├── examples/
├── tests/
├── docs/ # Full documentation
├── pyproject.toml # Build config
├── LICENSE
├── CHANGELOG.md
├── .gitignore
└── README.md
License
Distributed under the GNU General Public License v3.0. See LICENSE for details.
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 catpile-1.0.0.tar.gz.
File metadata
- Download URL: catpile-1.0.0.tar.gz
- Upload date:
- Size: 61.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06d944817351d742f840b2f021cf9158440eca8afff7b48e5fd44ea89f62615b
|
|
| MD5 |
53720ba9f6e8dee890a60ea1b8567022
|
|
| BLAKE2b-256 |
2305b9d4feaf32f7f7c1abab781057164bb7af090f710596482a0bc9e89417b5
|
Provenance
The following attestation bundles were made for catpile-1.0.0.tar.gz:
Publisher:
publish.yaml on SwirX/catpile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
catpile-1.0.0.tar.gz -
Subject digest:
06d944817351d742f840b2f021cf9158440eca8afff7b48e5fd44ea89f62615b - Sigstore transparency entry: 1673660986
- Sigstore integration time:
-
Permalink:
SwirX/catpile@1c3727ddb4eea9f08a9fe0b1215d91f6ee423757 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/SwirX
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@1c3727ddb4eea9f08a9fe0b1215d91f6ee423757 -
Trigger Event:
release
-
Statement type:
File details
Details for the file catpile-1.0.0-py3-none-any.whl.
File metadata
- Download URL: catpile-1.0.0-py3-none-any.whl
- Upload date:
- Size: 63.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a271aaa0d9aff45d90104ae1a78ca2e7cfbad06aad9e860bea2259713a55705
|
|
| MD5 |
16f2790ec54b4746c92ef6607eb9a2ff
|
|
| BLAKE2b-256 |
3e9fe7154bee4a09e8d3778bb9c6ae387328de8477689201cf0e6005b53c46df
|
Provenance
The following attestation bundles were made for catpile-1.0.0-py3-none-any.whl:
Publisher:
publish.yaml on SwirX/catpile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
catpile-1.0.0-py3-none-any.whl -
Subject digest:
7a271aaa0d9aff45d90104ae1a78ca2e7cfbad06aad9e860bea2259713a55705 - Sigstore transparency entry: 1673660989
- Sigstore integration time:
-
Permalink:
SwirX/catpile@1c3727ddb4eea9f08a9fe0b1215d91f6ee423757 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/SwirX
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@1c3727ddb4eea9f08a9fe0b1215d91f6ee423757 -
Trigger Event:
release
-
Statement type: