{"id":15636439,"url":"https://github.com/florianrappl/mages","last_synced_at":"2025-04-05T11:11:23.872Z","repository":{"id":49901518,"uuid":"57388458","full_name":"FlorianRappl/Mages","owner":"FlorianRappl","description":":tophat: MAGES is a very simple, yet powerful, expression parser and interpreter.","archived":false,"fork":false,"pushed_at":"2024-03-08T14:48:06.000Z","size":1363,"stargazers_count":123,"open_issues_count":2,"forks_count":12,"subscribers_count":12,"default_branch":"devel","last_synced_at":"2024-04-26T09:20:43.794Z","etag":null,"topics":["c-sharp","dotnet","expression-parser","interpreter","nuget"],"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/FlorianRappl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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},"funding":{"github":"FlorianRappl"}},"created_at":"2016-04-29T13:56:17.000Z","updated_at":"2024-06-28T20:37:11.244Z","dependencies_parsed_at":"2024-01-06T18:23:58.323Z","dependency_job_id":"c740ef6b-d99b-451f-a4f5-8ae89b2293d4","html_url":"https://github.com/FlorianRappl/Mages","commit_stats":{"total_commits":605,"total_committers":5,"mean_commits":121.0,"dds":0.06446280991735542,"last_synced_commit":"989b48160d0c7f2bf7f43959fbc5e491ba8a18ce"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorianRappl%2FMages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorianRappl%2FMages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorianRappl%2FMages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorianRappl%2FMages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FlorianRappl","download_url":"https://codeload.github.com/FlorianRappl/Mages/tar.gz/refs/heads/devel","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247325693,"owners_count":20920714,"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":["c-sharp","dotnet","expression-parser","interpreter","nuget"],"created_at":"2024-10-03T11:03:57.371Z","updated_at":"2025-04-05T11:11:23.849Z","avatar_url":"https://github.com/FlorianRappl.png","language":"C#","funding_links":["https://github.com/sponsors/FlorianRappl"],"categories":[],"sub_categories":[],"readme":"![MAGES Logo](./logo.png)\n\n# MAGES\n\n[![GitHub CI](https://github.com/FlorianRappl/Mages/actions/workflows/ci.yml/badge.svg)](https://github.com/FlorianRappl/Mages/actions/workflows/ci.yml) [![NuGet](https://img.shields.io/nuget/v/MAGES.svg?style=flat-square)](https://www.nuget.org/packages/Mages/) [![Issues](https://img.shields.io/github/issues/FlorianRappl/MAGES.svg?style=flat-square)](https://github.com/FlorianRappl/Mages/issues)\n\n## Mages: Another Generalized Expression Simplifier\n\nMAGES is the official successor to [YAMP](https://github.com/FlorianRappl/YAMP). It is a very simple, yet powerful, expression parser and interpreter. You can use MAGES to include a sophisticated, easy to customize, and lightweight scripting engine to your application.\n\nAmong other applications, MAGES has been used in [Microsoft's PowerToys](https://github.com/microsoft/PowerToys).\n\n### Current Status\n\n**2024**:\n\nMAGES was just updated (v3.0.0) with object metadata, direct list support, and JSX syntax.\n\nJSX as you know it - stringified via `html`:\n\n```plain\n\u003cdiv class={\"hello\" + \",\" + \"there\"}\u003e\u003ch1\u003eHi\u003c/h1\u003e\u003cp\u003eWorld.\u003c/p\u003e\u003c/div\u003e | html\n// result: \u003cdiv class=\"hello,there\"\u003e\u003ch1\u003eHi\u003c/h1\u003e\u003cp\u003eWorld.\u003c/p\u003e\u003c/div\u003e\n```\n\nObject metadata reflected via `type`:\n\n```plain\nnew { a: \"foo\", b: 42 } | type | json\n// {\n//   \"name\": \"Object\",\n//   \"create\": \"[Function]\",\n//   \"keys\": {\n//     \"0\": \"a\",\n//     \"1\": \"b\"\n//   }\n// }\n\n((x, y, z) =\u003e x + y + z) | type | json\n// {\n//   \"name\": \"Function\",\n//   \"create\": \"[Function]\",\n//   \"parameters\": {\n//     \"0\": \"x\",\n//     \"1\": \"y\",\n//     \"2\": \"z\"\n//   }\n// }\n```\n\nPlaceholders for calling functions / specifying what should be curry'ed:\n\n```plain\nvar f = (x, y, z) =\u003e x + 2 * y + 3 * z;\n5 | f(1, _, 2)\n// 17, by computing 1 + 2 * 5 + 3 * 2\n```\n\n### Previous Status\n\n**2023**:\n\nMAGES was updated (v2.0.0) with support for complex numbers. Also, the build target and runtime has been updated to make use of modern possibilities.\n\n**2018**:\n\nThe first stable version has been released. The current version 1.6.0 contains an improved REPL. The library contains everything to perform lightweight scripting operations in C#. A [CodeProject article](http://www.codeproject.com/Articles/1108939/MAGES-Ultimate-Scripting-for-NET) about the library (also containing some background and performance comparisons) is also available.\n\n### Installation\n\nMAGES itself does not have any dependencies, however, the tests are dependent on NUnit and the benchmarks use BenchmarkDotNet. Usually, MAGES should be installed via the NuGet package source. If this does not work for you, then clone the source and build MAGES yourself. Make sure that all unit tests pass.\n\nThe whole library was designed to be consumed from .NET Core 3.0 (or higher) / .NET 5.0 (or higher) applications. This means it is (amongst others) compatible with Unity 2021.2 or Mono 6.4. The NuGet package is available via [the official package feed](https://www.nuget.org/packages/MAGES).\n\n### Get Me Started!\n\nIn the most simple case you are creating a new engine to hold a global scope (for variables and functions) and launch the interpretation.\n\n```cs\nvar engine = new Mages.Core.Engine();\nvar result = engine.Interpret(\"sin(2) * cos(pi / 4)\"); // 0.642970376623918\n```\n\nYou can also go-ahead and make reusable blocks from snippets.\n\n```cs\nvar expOne = engine.Compile(\"exp(1)\");\nvar result = expOne(); // 2.71828182845905\n```\n\nOr you can interact with elements created by MAGES.\n\n```cs\nvar func = engine.Interpret(\"(x, y) =\u003e x * y + 3 * sqrt(x)\") as Mages.Core.Function;\nvar result = func.Invoke(new Object[] { 4.0, 3.0 }); // 18.0\n```\n\nOr even simpler (details are explained in the [getting started](doc/first-steps.md) document):\n\n```cs\nvar func = engine.Interpret(\"(x, y) =\u003e x * y + 3 * sqrt(x)\") as Mages.Core.Function;\nvar result = func.Call(4, 3); // 18.0\n```\n\nThese are just some of the more basic examples. More information can be found in the documentation.\n\n### Documentation\n\nThe documentation is given in form of Markdown documents being placed in the *doc* folder of this repository. The following links are worth checking out:\n\n* [First steps](doc/first-steps.md)\n* [Syntax documentation](doc/syntax.md)\n* [Included functions](doc/functions.md)\n* [Type system](doc/types.md)\n* [Performance evaluations](doc/performance.md)\n\nIf anything is missing, unclear, or wrong then either submit a PR or file an issue. See the following section on contributions for more information.\n\n### Contributions\n\nContributions in form of feature implementations or bug fixes are highly welcome, but need to be performed in an organized and consistent way. The [contribution guidelines](doc/contributing.md) should be read before starting any work.\n\nContributions may also be taken in form of bug reports and feature requests. Long live open-source development!\n\n### Versioning\n\nThe rules of [semver](http://semver.org/) are our bread and butter. In short this means:\n\n1. MAJOR versions at maintainers' discretion following significant changes to the codebase (e.g., breaking API changes)\n2. MINOR versions for backwards-compatible enhancements (e.g., performance improvements, additional extensions)\n3. PATCH versions for backwards-compatible bug fixes (e.g., specification compliance bugs, support issues)\n\nHence: Do not expect any breaking changes within the same major version.\n\n## Sponsors\n\nThe following companies sponsored part of the development of MAGES.\n\n\u003cdiv style=\"display:flex;justify-content:space-evenly;align-items:center\"\u003e\n    \u003cimg width=\"150\" height=\"150\" src=\"https://raw.githubusercontent.com/polytroper/polytroper.github.io/master/favicon.png\"\u003e\n    \u003cimg width=\"200\" height=\"200\" src=\"https://smapiot.com/smapiot_green.03d1162a.svg\"\u003e\n    \u003cimg width=\"200\" height=\"200\" src=\"https://www.omicron-lab.com/fileadmin/website/images/OMICRON-LAB.svg\"\u003e\n\u003c/div\u003e\n\nThanks for all the support and trust in the project!\n\n## License\n\nThis code is released using the MIT license. For more information see the [LICENSE file](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianrappl%2Fmages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflorianrappl%2Fmages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianrappl%2Fmages/lists"}