{"id":28295527,"url":"https://github.com/bt7s7k7/interpretedexpression","last_synced_at":"2025-09-05T02:04:33.518Z","repository":{"id":294488383,"uuid":"815143316","full_name":"bt7s7k7/InterpretedExpression","owner":"bt7s7k7","description":"Minimalist, dynamic and embeddable programming language for C#","archived":false,"fork":false,"pushed_at":"2025-06-04T18:23:54.000Z","size":213,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-01T10:02:47.533Z","etag":null,"topics":["config","configuration","csharp","csharp-library","customization","interpreter","metaprogramming","mod-loader","plugin-loader","programming-language"],"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/bt7s7k7.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,"zenodo":null}},"created_at":"2024-06-14T12:51:40.000Z","updated_at":"2025-06-04T18:23:57.000Z","dependencies_parsed_at":"2025-05-20T17:34:09.967Z","dependency_job_id":"22da23da-535a-411a-a3f7-d56bd3ab0f91","html_url":"https://github.com/bt7s7k7/InterpretedExpression","commit_stats":null,"previous_names":["bt7s7k7/interpretedexpression"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bt7s7k7/InterpretedExpression","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bt7s7k7%2FInterpretedExpression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bt7s7k7%2FInterpretedExpression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bt7s7k7%2FInterpretedExpression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bt7s7k7%2FInterpretedExpression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bt7s7k7","download_url":"https://codeload.github.com/bt7s7k7/InterpretedExpression/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bt7s7k7%2FInterpretedExpression/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273699712,"owners_count":25152286,"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","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"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":["config","configuration","csharp","csharp-library","customization","interpreter","metaprogramming","mod-loader","plugin-loader","programming-language"],"created_at":"2025-05-22T15:16:41.932Z","updated_at":"2025-09-05T02:04:33.508Z","avatar_url":"https://github.com/bt7s7k7.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Interpreted Expression\n\n```cs\nSystem.Console.WriteLine(\"Hello World\")\n```\n\nInterEx is a **minimalist, dynamic and embeddable** programming language designed to configure C# applications. Through its (almost) zero-config **interop with any C# libraries** it makes allows for easy runtime configuration of applications, creation of plugins and mods or definition of high-level workflows or data-pipelines.\n\nInterEx is made with the philosophy of only including the most basic features and leaving all other features to be **customized by the user** using modules. Most programming is calling functions and passing the results to other functions and that is what InterEx does well. All other language features are implemented through this simple framework, with only a small amount of syntax sugar.\n\nBut this also allows for a large amount of customization. InterEx includes a **full AST  metaprogramming** functionality, allowing the user to create all desired constructs without modifying the language internals.\n\n# Example\n\n```cs\nk_Using(System)\nk_Using(System.Text)\nk_Using(System.Collections.Generic)\n\n$list = List(String)().init(\"a\", \"b\", \"c\")\n\nConsole.WriteLine(String.Join(\", \", list))\n\n$dictionary = Dictionary(String, Int32)().init({ q: 5, a: 10, z: 21 })\n\ndictionary.forEach(^(kv) {\n    Console.WriteLine(StringBuilder()\n        .Append(kv.Key)\n        .Append(\": \")\n        .Append(kv.Value)\n    )\n})\n\n$test = TestClass()\n\ntest.Action2 = ^(stringValue, doubleValue) {\n    Console.WriteLine(stringValue)\n    Console.WriteLine(doubleValue)\n}\n\ntest.Action2.Invoke(\"a\", 5)\n\ntest.Func1 = ^(a) { a + 1 }\n\ntest.Func1.Invoke(1)\n```\n\nCheck out tests contained in `InterExTests.cs` to view additional examples.\n\n# Usage\n\nCurrently the best way to install this library is to copy its source files in the `inter_ex` folder.\n\n```cs\nvar engine = new IEEngine();\nengine.Integration.EntityProvider.LoadAllAssemblies();\n\ntry\n{\n    var document = new IEParser(\"path/to/file.ie\", fileContent).Parse();\n    var result = engine.Evaluate(document.Root, engine.PrepareCall());\n    Console.WriteLine(result.ToString());\n}\ncatch (IEParsingException error)\n{\n    Console.WriteLine(\"[SYN] \" + error.Message);\n}\ncatch (IERuntimeException error)\n{\n    Console.WriteLine(\"[ERR] \" + error.FlattenMessage());\n}\n```\n\nCheck `Program.cs` for a simple script-runner and REPL.\n\n# Guide\n\n## Syntax\n\nDefine a variable using the `$` operator.\n\n```cs\n$val = 5\n```\n\nLater references to variables do not use `$`, only their name. You can call a function using `()`.\n\n```cs\nfunc(val)\n```\n\nYou can access a method or a property.\n\n```cs\ninstance.Value = 10\ninstance.Method(\"String\")\n```\n\nYou can define delegates using the `^` operator. The last expression contained within is used as the return value.\n\n```cs\n^(param1, param2) { param1.Use(param2) }\n^{ /* Zero parameter delegate */ }\n```\n\nThe are also literals for numbers, strings, arrays and dictionaries.\n\n```cs\n\"string literal\"\n$\"interpolated literal ${52:F2}\"\n350420\n[elem1, elem2, elem3]\n{ key: value, key2: 58 }\n```\n\n## Operators\n\nOperators are mapped to methods defined in the `IEOperators` class. This class is partial and it is expected that a user will expand it with overloads and additional operators related to their use-case. All methods on `IEOperators` are available and all objects, where the receiver is instead used as the first argument.\n\nThere is also special syntax defined for calling a selection of operators. The following operators have special syntax:\n\n| Operator | Function |\n| ---------| -------- |\n| (unary) `-` | `neg` |\n| (unary) `!` | `not` |\n| `=` | (assignment)  |\n| `\u0026\u0026` | `k_Then` |\n| `\\|\\|` | `k_Else` |\n| `\u003c` | `lt` |\n| `\u003c=` | `lte` |\n| `\u003e` | `gt` |\n| `\u003e=` | `gte` |\n| `==` | `eq` |\n| `!=` | `neq` |\n| `+` | `add` |\n| `-` | `sub` |\n| `*` | `mul` |\n| `/` | `div` |\n| `%` | `mod` |\n| `.` | (member access) |\n| `()` | (invocation) |\n| `[]` | (index) |\n\nSeveral operators have a special implementation that does not map to a function but creates a custom syntax construct. Details can be found in the `IEParser.ParseExpression()` method. It is also worth mentioning that, because `k_Then` and `k_Else` are keyword functions, they can not be overloaded.\n\n## Metaprogramming\n\nMore complex language features are created by using metaprogramming. This is done through so called keyword functions, which are functions prefixed by `k_`. These functions are called with AST trees instead of evaluated values which allows for definition of any other language features by the user.\n\n```cs\nk_Using(System)\n\n$i = 0\n$len = 10\n\ni.lt(len).k_While((\n    Console.WriteLine(i)\n    i = i.add(1)\n))\n```\n\n## C# Interop\n\nInterEx can perform all operations on any provided C# object. Executing the `EntityProvider.LoadAllAssemblies()` method allows you to import C# namespaces and use their classes directly.\n\nInterEx is a dynamic language. That means the types of variables and function calls is only checked at runtime. To make this more simple for a user, InterEx uses simpler internal values which are then converted into C# types on use. For example instead of all C#'s number types, InterEx just has a single number type representing a double.\n\nInterop with C# happens through the import/export process where internal values are converted based on the desired C# type. InterEx defines importers and exporters for simple values but allows the user to easily create their own, check `IntrinsicSource.cs` for how to do it. For all unsupported types, the values are simply preserved.\n\nFunction calls to C# methods are performed using reflection. All reflection objects are cached for performance. This process can also be customized by the user, for example allowing you to add a custom method to a specific class or interface through a `ClassPatcher` delegate.\n\n# Editor Integration\n\nSyntax highlighting extension is available for VSCode, inside the `extension` folder. You can install it using the `workbench.extensions.action.installExtensionFromLocation` command.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbt7s7k7%2Finterpretedexpression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbt7s7k7%2Finterpretedexpression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbt7s7k7%2Finterpretedexpression/lists"}