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
OnWebsiteLoaded
local myVar = 10
object myObjVar = "hello"
-- emits USER_GET_NAME
local name = LocalPlayer.Name
print(`welcome {name}!`)
end
Annotations
--#type audio
mySong.Volume = 8
mySong.PlaybackSpeed = 1.2
--#type
-- the compiler knows this is an object and emits TABLE_SET_OBJ
myTable["btn"] = (MenuButton)
Method Desugaring
-- compiles down perfectly to IF_IS_ANCESTOR and IF_CONTAINS
if ancestor:IsAncestorOf(child) then
if myString:find("hello") then
print("found it!")
end
end