{"id":16386689,"url":"https://github.com/lofcz/sxscript","last_synced_at":"2026-06-25T09:31:32.200Z","repository":{"id":88696418,"uuid":"412644095","full_name":"lofcz/sxscript","owner":"lofcz","description":"Embeddable scripting language for C#. WIP. Goals: async/await, il bytecode, safe by default, performance.","archived":false,"fork":false,"pushed_at":"2021-11-28T02:32:38.000Z","size":467,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-15T18:58:25.198Z","etag":null,"topics":["ast","bytecode","csharp","embeddable-scripting-language","evaluation","language","scripting"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lofcz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2021-10-01T23:38:40.000Z","updated_at":"2022-08-07T12:22:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"e6df595b-438f-46f8-bc11-a4dfd759a839","html_url":"https://github.com/lofcz/sxscript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lofcz%2Fsxscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lofcz%2Fsxscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lofcz%2Fsxscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lofcz%2Fsxscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lofcz","download_url":"https://codeload.github.com/lofcz/sxscript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240156777,"owners_count":19756835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","csharp","embeddable-scripting-language","evaluation","language","scripting"],"created_at":"2024-10-11T04:23:19.096Z","updated_at":"2026-05-28T20:30:17.356Z","avatar_url":"https://github.com/lofcz.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![nuget](https://img.shields.io/nuget/v/SxScript)\n\n# SxScript\n\nEmbeddable scripting language for C# written in C#.  \n\n```\nInstall-Package SxScript\n```\nHello world:\n```csharp\nSxScript.SxScript script = new SxScript.SxScript();\nstring stdout = await script.Interpret(\"print \\\"hello world\\\"\");\n```\n\nFirst 10 Fibonacci numbers, recursive:\n```csharp\nfunction fib(n) {\n  if (n \u003c= 1) return n;\n  return fib(n - 2) + fib(n - 1);\n}\n\nfor (var i = 0; i \u003c 10; i++) {\n  print fib(i);\n}\n\n// result: 0 1 1 2 3 5 8 13 21 34\n```\nCheck https://github.com/lofcz/sxscript/tree/master/SxScriptTests/Programs for more programs.\n\n### Goals of this project are (in order of priority, desc)  \n- good test coverage\n- support both adhoc evaluation and il bytecode + vm\n- high IO throughput via async/await\n- safe by default, require explicit whitelisting of CLR interop\n- allow limitation of execution time, memory used, intructions executed, recursion depth, enumerables length, iterations in looping statements\n- syntactically be a relaxed subset of C# (inclined towards Lua, JS)\n- visitable AST\n\n### Progress tracker  \n- statements\n  - branching\n    - [x] if\n    - [x] else if / else\n    - [x] ternary (a ? b : c) \n    - [ ] switch\n  - looping\n    - [x] while\n    - [x] for\n    - [ ] foreach\n  - jump\n    - [x] goto\n    - [x] break\n    - [x] continue\n    - [x] return\n   - labeled\n    - [x] label\n    - [ ] case\n    - [ ] default\n   - scope\n    - [x] code block {}\n    - [x] global scope \n    - [x] variable shadowing\n   - logical \n    - [x] and / \u0026\u0026\n    - [x] or / ||\n    - [x] short circuit\n   - bitwise\n    - [ ] \u0026\n    - [ ] |\n   - modifiers\n    - [x] await\n    - [ ] async\n    - [ ] public\n    - [ ] private\n    - [x] static\n   - base types\n    - [x] function \n    - [x] null / nill \n    - [x] int\n    - [x] double\n    - [x] string\n    - [x] bool\n    - [x] object\n    - [x] true, false\n    - [x] array (hashmap)\n - operators\n  - [x] assignment\n  - [x] unary +, -\n  - [x] binary +, -, *, /, %, ^\n  - [x] compound assignment +=, *=, /=, -=, %=, ^=\n  - [ ] null coalescing ??, ??=\n  - postfix  \n   - [x] ++, --\n   - [ ] arrays\n   - [ ] object members   \n - comments\n  - [x] // single line\n  - [ ] /* */ multiline comment. nesting won't be allowed\n- evaluation\n - [x] interpretation\n - [ ] bytecode + vm\n- OOP\n - [x] classes\n - [x] this\n - [x] constructors\n - [x] static methods\n - [ ] access modifiers (public, private)\n - [x] inheritance\n - [ ] polymorphism\n - [ ] getters \u0026 setters\n - [ ] traits\n- FFI\n - [x] (partially) calling FFI functions, this should support both `Func\u003cT1..T16\u003e` + `Action\u003cT1..T16\u003e` and `Func\u003cTask\u003cT1..T16\u003e\u003e` + `Action\u003cTask\u003cT1..T16\u003e\u003e`\n- sugar\n - [x] default parameter values `fn sum(a = 1, b = 2) {}`\n - [x] parameter by name `myFn(myParam: 1)`\n- misc\n - [x] local functions\n - [x] anonymous functions (lambdas)\n - [ ] params `fn sum(params numbers)` \n \n### Notes\n- semicolons are optional\n- parenthesis around keywords are optional. Both `if (condition)` and `if condition` are valid\n- scopes are optional. Implicit scope is one statement. `a = 0 if 1 \u003e 2 a = 2 print a` is valid\n- tabs are always discarded (no ident / dedent)\n- newlines are almost always discarded\n- dynamic type control. Optional static types. Implicit var declaration. Both `a = 0` and `var a = 0` is valid. In future `int a = 0` should be valid too.\n- SxScript is as permissive as possible. Aborting execution is always considered the last option. This is probably not a very good design but I love languages with this behavior (Lua).\n- exceptions are not used to control flow (return, continue, break..)\n\n### Great projects I'd like to mention here\n- https://github.com/codingseb/ExpressionEvaluator\n- https://github.com/moonsharp-devs/moonsharp/\n- https://github.com/scriban/scriban\n- https://github.com/sebastienros/fluid\n- https://github.com/sebastienros/jint\n- https://github.com/microsoft/ClearScript\n- https://github.com/munificent/craftinginterpreters (literature)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flofcz%2Fsxscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flofcz%2Fsxscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flofcz%2Fsxscript/lists"}