LynxScript is a programming language designed for CatWeb, a Roblox game where users can build website-esque creations.
The LynxScript compiler compiles source code files into a JSON format that can be imported into CatWeb.
NOTE: This project is in early development and is still work in progress. Expect bugs and breaking changes.
// Familiar syntax to web-devs
console.log("Hello, world!");
// In-language standard library definition
#[export_as("console.log")]
function log(arg) {
// Raw CatWeb block ID calls
#0(#"", arg);
}# Compile a LynxScript source file to JSON and output it to output.json
lync --compile ./src/main.lxs --output ./out/output.json
# Or just output the JSON onto the console
lync -c ./src/main.lxs
# (-c is shorthand for --compile, and -o for --output)- Function declarations
- Event handlers
- Raw CatWeb block ID calls
- In-language standard library implementation
- Link statement (Importing site JSON files and reference UI objects)
- Arbitary expression compilation (binary, boolean)
- Return statements
- If statements
- Loops
- Optimizations
- Function inlining
- Constant folding
- Dead code elimination
- Install Rust and Cargo from the official Rust website
- Clone the repository
- Go to the project directory and install the CLI tool with the following command:
cargo install --path .- You can now use the
lynccommand in your terminal to compile LynxScript files!
- Rust (Edition 2024 or newer)
- Cargo (comes with Rust)
- Deno (Option, only used for data generation scripts)
To build the project, run the following command in the project directory:
cargo buildTo run the CLI in development mode, use the following commands in the project directory:
# Compiles the script and output to a file
cargo run -- --compile "<path_to_your_script>.lxs" --output "<path_to_destination>.json"
# Compiles the script and output to stdout
cargo run -- -c "<path_to_your_script>.lxs"
# -c is shorthand for --compile, and -o for --outputThis project is licensed under the MIT License
- Built with the blazingly fast Rust
- PEG-grammar parser powered by pest
- Similar project: catlua also shaped the ecosystem of CatWeb text-based programming languages ✨
⭐ Star this repo if you find it helpful!
Made with ❤️ by pickaxe828 and the contributors