{"id":31879967,"url":"https://github.com/l2060/aurorascript","last_synced_at":"2026-05-14T20:03:21.353Z","repository":{"id":39649838,"uuid":"437240817","full_name":"l2060/AuroraScript","owner":"l2060","description":"lightweight weakly typed script compiler runtime","archived":false,"fork":false,"pushed_at":"2026-01-25T12:33:20.000Z","size":14264,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2026-03-18T08:52:42.564Z","etag":null,"topics":["ast","bytecode","compiler","csharp","dotnet","interpreter","language-runtime","performance","script","scriptengine","scripting","virtual-machine"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/l2060.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-12-11T09:35:58.000Z","updated_at":"2026-01-25T12:33:24.000Z","dependencies_parsed_at":"2024-09-18T12:25:07.703Z","dependency_job_id":"2a7e8334-952d-46db-a340-f26c3cb2a5ea","html_url":"https://github.com/l2060/AuroraScript","commit_stats":null,"previous_names":["l2060/aurorascript"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/l2060/AuroraScript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2060%2FAuroraScript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2060%2FAuroraScript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2060%2FAuroraScript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2060%2FAuroraScript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/l2060","download_url":"https://codeload.github.com/l2060/AuroraScript/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2060%2FAuroraScript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33041204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","bytecode","compiler","csharp","dotnet","interpreter","language-runtime","performance","script","scriptengine","scripting","virtual-machine"],"created_at":"2025-10-13T00:55:12.850Z","updated_at":"2026-05-14T20:03:21.344Z","avatar_url":"https://github.com/l2060.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿\u003cp align=\"center\"\u003e\n  \u003cimg src=\"icon.png\" width=\"128\" alt=\"AuroraScript Logo\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"./README_CN.md\"\u003e简体中文\u003c/a\u003e | \u003ca href=\"./README.md\"\u003eEnglish\u003c/a\u003e\n\u003c/p\u003e\n\n# AuroraScript\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://github.com/l2060/AuroraScript)\n[![Version](https://img.shields.io/badge/version-1.0.0-orange.svg)](package.json)\n\nAuroraScript is a lightweight, weak-typed script execution engine built on .NET. It compiles scripts into bytecode and executes them on a custom Virtual Machine (VM), designed to be fast, embeddable, and easy to use.\n\nWhile inspired by JavaScript syntax and mechanisms, AuroraScript is a distinct language with its own optimizations and features, and does not adhere to ECMA specifications. It supports native .NET integration and debugging.\n\n\u003e [!NOTE]\n\u003e 🚧 **Work in Progress**: The project is still in development. Performance and API stability are improving. We welcome **PRs** and **Issues** to help make AuroraScript better!\n\n## ✨ Features\n\n- **Lightweight \u0026 Fast**: No third-party dependencies. Bytecode compilation and optimized VM execution.\n- **Weak Typed**: Flexible variable typing similar to JavaScript.\n- **Native Interop**: Seamlessly register and use .NET (CLR) types and functions within scripts.\n- **Debugging Support**: Full VS Code debugger support (Breakpoints, stepping, variable inspection, call stack).\n- **Module System**:\n  - `import xxx from 'xxx'`: Import module exports.\n  - `include 'xxx.as'`: Embed script files directly.\n  - `@module(\"NAME\")`: Define module name.\n- **Advanced Control Flow**:\n  - `yield`: Interrupt execution.\n  - `Interruption \u0026 Continue`: Pause and resume script execution from external host.\n  - `debugger`: Programmatic breakpoint.\n  - `where` / `for` loop enhancements.\n- **Modern Syntax**:\n  - Closures, Lambdas, and Function Pointers.\n  - Destructuring assignment: `var { a, b } = obj;` and `var [ a, ...b ] = arr;`.\n  - Spread operator: `...` for arrays and objects.\n  - Template literals: Multi-line strings with `` ` `` or `|\u003e` syntax.\n- **Standard Library**: Built-in support for `Math`, `JSON`, `Date`, `Regex`, and `StringBuffer`.\n\n## 🚀 Getting Started\n\n### Installation via NuGet\n\nYou can easily install the AuroraScript engine via NuGet:\n\n```bash\ndotnet add package AuroraScript\n```\n\n### Manual Installation\n\nClone the repository:\n\n```bash\ngit clone https://github.com/l2060/AuroraScript.git\ncd AuroraScript\n```\n\n### Compiling the Project\n\nTo build the core engine library:\n\n```bash\ndotnet build src/AuroraScript.csproj -c Release\n```\n\n## 📖 Usage\n\n### Running a Script (Host Application)\n\nYou can host the engine in your own .NET application.\n\n```csharp\nusing AuroraScript;\nusing AuroraScript.Runtime;\n\n// 1. Initialize Engine\nvar options = EngineOptions.Default.WithBaseDirectory(\"./scripts/\");\nvar engine = new AuroraEngine(options);\n\n// 2. Register CLR Types/Functions\nengine.RegisterClrType(typeof(Math), \"Math2\");\n\n// 3. Compile Scripts\nawait engine.BuildAsync();\n\n// 4. Create Domain \u0026 Execute\nvar domain = engine.CreateDomain();\n// Execute 'main' function in 'MAIN' module\ndomain.Execute(\"MAIN\", \"main\");\n```\n\n### Writing Scripts\n\nAuroraScript uses a syntax familiar to JavaScript developers:\n\n```javascript\n@module(\"MAIN\");\n\nfunc main() {\n    console.log(\"Hello, AuroraScript!\");\n    \n    // Using imported CLR library\n    var res = Math2.Abs(-100);\n    console.log(\"Abs result: \" + res);\n\n    var list = [1, 2, 3, 4, 5];\n    for (var item in list) {\n        if (item % 2 == 0) {\n            console.log(\"Even number: \" + item);\n        }\n    }\n}\n```\n\n## 🐞 Debugging Scripts\n\nAuroraScript provides a full-featured VS Code debugger.\n\n### 1. Setup Extension\n\n1.  **Open Extension Folder**: Open `vscode-extension` in VS Code.\n2.  **Install Dependencies**: `npm install`\n3.  **Package**: `npm run package` -\u003e Generates a `.vsix` file.\n4.  **Install**: Install the `.vsix` file via VS Code Extensions menu.\n\n### 2. Configure Wrapper\n\nCreate `.vscode/launch.json` in your script project:\n\n```json\n{\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"type\": \"AuroraScript\",\n            \"request\": \"attach\",\n            \"name\": \"Attach to AuroraScript\",\n            \"host\": \"localhost\",\n            \"port\": 26010\n        }\n    ]\n}\n```\n\n### 3. Start Debugging\n\n1.  Enable debugger in your C# host:\n    ```csharp\n    engine.EnableDebugger();\n    await engine.WaitAnyDebugger(TimeSpan.FromSeconds(60));\n    ```\n2.  Run host.\n3.  Press `F5` in VS Code.\n\n### Features\n- **Breakpoints**: Set breakpoints in `.as` files.\n- **Stepping**: Step Over, Step Into, Step Out.\n- **Variables**: Inspect properties of Objects, Arrays, and Closures.\n- **Call Stack**: View call frames handling script execution.\n- **`debugger` Statement**: Use the `debugger;` keyword in your code to trigger a programmatic breakpoint.\n\n![Debugger Demo](documents/debugger.png)\n\n*Built-in type definitions for easier development:*\n![Type Definitions](documents/lib.d.as.png)\n\n## 📚 Built-in API\n\nThe AuroraScript runtime provides a comprehensive standard library.\n\n### Core Types\n\n| Type | Description | Key Methods |\n| :--- | :--- | :--- |\n| **Object** | Base object type | `keys()`, `values()`, `assign()`, `toString()` |\n| **String** | Textual data | `length`, `substring`, `indexOf`, `split`, `replace`, `trim` |\n| **Number** | Numeric values | `toFixed`, `toString`, `isNaN` |\n| **Boolean** | Logical values | `toString`, `valueOf` |\n| **Array** | Ordered collection | `push`, `pop`, `shift`, `slice`, `splice`, `join`, `map` |\n| **Function** | Callable object | `call`, `apply`, `bind` |\n\n### Standard Library\n\n| Object | Description | Key Methods |\n| :--- | :--- | :--- |\n| **console** | Logging I/O | `log(msg)`, `error(msg)`, `warn(msg)` |\n| **Math** | Math Utilities | `sin`, `cos`, `tan`, `sqrt`, `pow`, `random`, `PI`, `E` |\n| **JSON** | JSON Serialization | `parse(string)`, `stringify(object)` |\n| **Date** | Date Time | `now()`, `parse(string)`, constructors `new Date()` |\n| **Regex** | Regular Expressions | constructors `new Regex(pattern)`, `match(str)`, `replace(str, repl)` |\n| **StringBuffer** | String Builder | `append(str)`, `toString()`, high-perf string concatenation |\n\n### Global Context\n- `global`: References the root global scope.\n- `$state`: Access user-injected state object (from C# `ExecuteOptions.WithUserState`).\n- `$args`: Array of arguments passed to the current function.\n\n## 📊 Benchmark Results\n\nPerformance is a priority. We encourage community contributions to optimize further!\n\n| Method | Mean | StdDev | Allocated |\n| :--- | :---: | :---: | :---: |\n| **TestIfTrue** | 225.1 ns | 0.19 ns | - |\n| **TestAssuming** | 227.0 ns | 0.51 ns | - |\n| **TestAddVar** | 240.6 ns | 0.50 ns | - |\n| **TestGetVar** | 243.5 ns | 0.37 ns | - |\n| **TestSetVar** | 250.7 ns | 0.39 ns | - |\n| **TestSetProperty** | 257.0 ns | 1.05 ns | 48 B |\n| **TestGetProperty** | 269.3 ns | 0.44 ns | - |\n| **TestClone** | 515.6 ns | 1.34 ns | 1072 B |\n| **TestIterator** | 822.1 ns | 2.09 ns | 1056 B |\n| **TestJson** | 1,907.2 ns | 6.53 ns | 4520 B |\n| **TestRegex** | 3,604.4 ns | 7.77 ns | 8696 B |\n| **TestStrings** | 979.7 $\\mu$s | 3.27 $\\mu$s | 3.48 MB |\n| **TestClosure** | 1.00 ms | 2.27 $\\mu$s | 496 B |\n| **TestObjects** | 1.38 ms | 5.06 $\\mu$s | 5.14 MB |\n| **TestArrays** | 1.40 ms | 15.13 $\\mu$s | 2.22 MB |\n| **TestFor100W** | 10.25 ms | 112.7 $\\mu$s | - |\n\n\u003e Measured on Intel Core i7-13700KF, .NET 10.0.1.\n\n## 📂 Examples\n\n- [**Basic Tests**](examples/tests/main.as): Syntax and module loading.\n- [**Benchmarks**](benchmark/scripts/unit.as): Performance scripts.\n\n---\n\nMade with ❤️ by [l2060](https://github.com/l2060)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl2060%2Faurorascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fl2060%2Faurorascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl2060%2Faurorascript/lists"}