Skip to content

pickaxe828/LynxScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐱 LynxScript

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.

Usage

Syntax

// 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);
}

Command line interface

# 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)

Features/ Roadmap

  • 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

Installation

  1. Install Rust and Cargo from the official Rust website
  2. Clone the repository
  3. Go to the project directory and install the CLI tool with the following command:
cargo install --path .
  1. You can now use the lync command in your terminal to compile LynxScript files!

Development

Prerequisites

  • Rust (Edition 2024 or newer)
  • Cargo (comes with Rust)
  • Deno (Option, only used for data generation scripts)

Building and Running

To build the project, run the following command in the project directory:

cargo build

To 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 --output

License

This project is licensed under the MIT License

Acknowledgments

  • 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

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages