A full front-to-back compiler toolchain and VS Code Language Server for CatWeb (v2.16+). Write your CatWeb scripts in a clean, Luau-flavored syntax and compile them directly into CatWeb-ready JSON files.
- Custom Compiler Pipeline: Lexing, parsing, semantic analysis, and IR emission built from scratch.
- Optimizer: Features constant folding and Dead Code Elimination (DCE) via
-O1and-O2flags so your scripts are optimized in action counts. - VS Code Extension: Real-time linting, rich auto-complete menus for CatWeb services, and full syntax highlighting.
- Scope Tracking: Explicit tracking for
local(l!),global(g!), andobject(o!) variables. - Annotations: Use
--#type audio(--@ type=audio) or--@ builtinto force specific CatWeb routing (likeAVAR_SETvsLOOK_SET_PROP). - Multi-File Linker: Organize massive projects using
require("file.catlua"). - Safety: Automatically warns you if you hit the CatWeb 120-action limit per event.
- Clone this repository
- Ensure you have Python installed
- Run the compiler via CLI:
python main.py <file.catlua> [-o output.json] [--ir] [-O0|-O1|-O2]
- Grab the
.vsixfile inside the Releases tab, or build the extension yourself - Go to your VS Code Settings and search for
CatLua - Set the
Compiler Pathto the absolute path of yourmain.pyfile
Basic Scopes and Services
OnWebsiteLoadedlocalmyVar=10objectmyObjVar="hello"-- emits USER_GET_NAMElocalname=LocalPlayer.Nameprint(`welcome {name}!`)
endAnnotations
--#type audiomySong.Volume=8mySong.PlaybackSpeed=1.2--#type-- the compiler knows this is an object and emits TABLE_SET_OBJmyTable["btn"] = (MenuButton)
Method Desugaring
-- compiles down perfectly to IF_IS_ANCESTOR and IF_CONTAINSifancestor:IsAncestorOf(child) thenifmyString:find("hello") thenprint("found it!")
endend