![]() |
VOOZH | about |
dotnet add package Mages --version 3.0.1
NuGet\Install-Package Mages -Version 3.0.1
<PackageReference Include="Mages" Version="3.0.1" />
<PackageVersion Include="Mages" Version="3.0.1" />Directory.Packages.props
<PackageReference Include="Mages" />Project file
paket add Mages --version 3.0.1
#r "nuget: Mages, 3.0.1"
#:package Mages@3.0.1
#addin nuget:?package=Mages&version=3.0.1Install as a Cake Addin
#tool nuget:?package=Mages&version=3.0.1Install as a Cake Tool
MAGES is the official successor to 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.
Among other applications, MAGES has been used in Microsoft's PowerToys.
2024:
MAGES was just updated (v3.0.0) with object metadata, direct list support, and JSX syntax.
JSX as you know it - stringified via html:
<div class={"hello" + "," + "there"}><h1>Hi</h1><p>World.</p></div> | html
// result: <div class="hello,there"><h1>Hi</h1><p>World.</p></div>
Object metadata reflected via type:
new { a: "foo", b: 42 } | type | json
// {
// "name": "Object",
// "create": "[Function]",
// "keys": {
// "0": "a",
// "1": "b"
// }
// }
((x, y, z) => x + y + z) | type | json
// {
// "name": "Function",
// "create": "[Function]",
// "parameters": {
// "0": "x",
// "1": "y",
// "2": "z"
// }
// }
Placeholders for calling functions / specifying what should be curry'ed:
var f = (x, y, z) => x + 2 * y + 3 * z;
5 | f(1, _, 2)
// 17, by computing 1 + 2 * 5 + 3 * 2
2023:
MAGES 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.
2018:
The 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 about the library (also containing some background and performance comparisons) is also available.
MAGES 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.
The 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.
In the most simple case you are creating a new engine to hold a global scope (for variables and functions) and launch the interpretation.
var engine = new Mages.Core.Engine();
var result = engine.Interpret("sin(2) * cos(pi / 4)"); // 0.642970376623918
You can also go-ahead and make reusable blocks from snippets.
var expOne = engine.Compile("exp(1)");
var result = expOne(); // 2.71828182845905
Or you can interact with elements created by MAGES.
var func = engine.Interpret("(x, y) => x * y + 3 * sqrt(x)") as Mages.Core.Function;
var result = func.Invoke(new Object[] { 4.0, 3.0 }); // 18.0
Or even simpler (details are explained in the document):
var func = engine.Interpret("(x, y) => x * y + 3 * sqrt(x)") as Mages.Core.Function;
var result = func.Call(4, 3); // 18.0
These are just some of the more basic examples. More information can be found in the documentation.
The documentation is given in form of Markdown documents being placed in the doc folder of this repository. The following links are worth checking out:
If anything is missing, unclear, or wrong then either submit a PR or file an issue. See the following section on contributions for more information.
Contributions in form of feature implementations or bug fixes are highly welcome, but need to be performed in an organized and consistent way. The should be read before starting any work.
Contributions may also be taken in form of bug reports and feature requests. Long live open-source development!
The rules of semver are our bread and butter. In short this means:
Hence: Do not expect any breaking changes within the same major version.
The following companies sponsored part of the development of MAGES.
<div style="display:flex;justify-content:space-evenly;align-items:center"> <img width="150" height="150" src="https://raw.githubusercontent.com/polytroper/polytroper.github.io/master/favicon.png"> <img width="200" height="200" src="https://smapiot.com/smapiot_green.03d1162a.svg"> <img width="200" height="200" src="https://www.omicron-lab.com/fileadmin/website/images/OMICRON-LAB.svg"> </div>
Thanks for all the support and trust in the project!
This code is released using the MIT license. For more information see the .
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on Mages:
| Package | Downloads |
|---|---|
|
OmicronLab.VectorNetworkAnalysis.MidLayer
This package contains all the Mid-Layer components needed to measure with a VNA device. |
|
|
LisaCore
CSharp dynamic runtime code execution |
Showing the top 1 popular GitHub repositories that depend on Mages:
| Repository | Stars |
|---|---|
|
Flow-Launcher/Flow.Launcher
:mag: Quick file search & app launcher for Windows with community-made plugins
|
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.1 | 8,453 | 11/13/2025 |
| 3.0.1-alpha-67 | 304 | 11/13/2025 |
| 3.0.0 | 15,731 | 12/24/2024 |
| 3.0.0-alpha-61 | 200 | 12/24/2024 |
| 3.0.0-alpha-59 | 194 | 12/24/2024 |
| 3.0.0-alpha-57 | 182 | 12/24/2024 |
| 3.0.0-alpha-55 | 192 | 12/24/2024 |
| 3.0.0-alpha-53 | 199 | 12/21/2024 |
| 3.0.0-alpha-52 | 185 | 12/21/2024 |
| 3.0.0-alpha-51 | 214 | 12/21/2024 |
| 3.0.0-alpha-50 | 206 | 12/21/2024 |
| 3.0.0-alpha-49 | 214 | 9/5/2024 |
| 3.0.0-alpha-45 | 231 | 8/7/2024 |
| 3.0.0-alpha-44 | 155 | 7/28/2024 |
| 3.0.0-alpha-41 | 181 | 7/28/2024 |
| 2.0.3-alpha-31 | 332 | 1/7/2024 |
| 2.0.2 | 20,875 | 1/7/2024 |
| 2.0.2-alpha-28 | 250 | 1/7/2024 |
| 2.0.1 | 30,387 | 6/17/2022 |
| 2.0.1-alpha-24 | 419 | 6/17/2022 |
For all changes see: https://github.com/FlorianRappl/Mages/blob/main/CHANGELOG.md.