Starlight Programming Language

Developed by Dominex Macedon

Installation

Install the Starlight CLI globally using npm:

npm install -g starlight-cli@latest

Getting Started

Starlight is a Python/JavaScript hybrid scripting language. Here's a simple example:

// Hello World in Starlight
let greeting = "Hello, Starlight!";
sldeploy(greeting);

Variables

Declare variables using let and optionally assign values:

let x = 10;
let name = "Dominex";
let flag = true;

Functions

Define regular and async functions:

// Regular function
func add(a, b) {
  return a + b;
}

// Async function
async func fetchData(url) {
  let response = await fetch(url);
  return await response.json();
}

Arrow Functions

Starlight supports concise arrow function syntax:

let square = x => x * x;
sldeploy(square(5)); // 25

Conditionals

Supports if, else if, and else:

let x = 15;

if x > 10 {
  sldeploy("x is greater than 10");
} else {
  sldeploy("x is 10 or less");
}

Loops

Starlight has Python-style and C-style loops:

// Python-style
for let i in range(5) {
  sldeploy(i);
}

// C-style
for (let i = 0; i < 5; i++) {
  sldeploy(i);
}

while x > 0 {
  sldeploy(x);
  x--;
}

Special Statements

Starlight includes:

sldeploy { "name": "Dominex", "score": 100 }
do {
  riskyOperation();
} track {
  sldeploy(error);
}
let name = ask("Enter your name:");
sldeploy("Hello " + name);

Imports

Import modules using JavaScript-like syntax:

import fs from "fs";
import { readFile, writeFile as save } from "./utils.sl";
import * as helpers from "./helpers.sl";

Built-in Functions

Objects and Arrays

let arr = [1, 2, 3];
let obj = { "name": "Dominex", "score": 100 };
sldeploy(arr[0]); // 1
sldeploy(obj.name); // Dominex

Example Program

let scores = [10, 20, 30];

for let s in scores {
  if s > 15 {
    sldeploy(s + " is high!");
  } else {
    sldeploy(s + " is low!");
  }
}

async func main() {
  let data = await fetch("https://api.example.com/data");
  sldeploy(data);
}

main();

License & Author

Developed by Dominex Macedon. For installation, use:

npm install -g starlight-cli@latest