ReoScript is an ECMAScript-like scripting engine for .NET applications. It is designed for embedding, so host applications can execute user-defined scripts, expose application objects to scripts, and optionally allow direct access to .NET types, members, and events.
The current migrated solution targets .NET 10 and contains:
Source/ReoScript/: the core scripting librarySource/ReoScriptRunner/: a command-line runner for.reofilesSource/TestCase/: xUnit-based language and engine tests
- JavaScript-like syntax with ReoScript-specific extensions
- Embed scripts into .NET applications through
ScriptRunningMachine - Pass host values into scripts as globals
- Register native C# functions callable from script
- Optional direct access to .NET objects and imported CLR types
- Closures, lambda expressions, JSON, modules, and timer-based async callbacks
- Extra language features such as object merge, object spread, destructuring, and tag-style syntax
Build the solution:
dotnet build Source/ReoScript.slnRun the CLI runner:
dotnet run --project Source/ReoScriptRunner -- sample.reo
dotnet run --project Source/ReoScriptRunner -- -e "console.log(1 + 2)"
dotnet run --project Source/ReoScriptRunner -- -consoleMinimal embedding example:
using unvell.ReoScript;
var srm = new ScriptRunningMachine();
srm.SetGlobalVariable("appName", "Demo");
srm.Run(@"
function add(a, b) {
return a + b;
}
");
var result = srm.CalcExpression("add(10, 20)");Minimal script example:
var total = 0;
for (var i = 1; i <= 10; i++) {
total += i;
}
console.log(total);Build all migrated projects:
dotnet build Source/ReoScript.slnRelease build:
dotnet build Source/ReoScript.sln -c ReleaseRun all tests:
dotnet test Source/ReoScript.slnRun the test project directly:
dotnet test Source/TestCase/TestCase.csprojRun a filtered test:
dotnet test Source/TestCase/TestCase.csproj --filter "DisplayName~closure"The test project covers:
- XML-driven language tests under
Source/TestCase/tests/ - CLR interop tests
- engine-level tests for loop protection, module loading, truthy/falsy rules, async timers, and error reporting
Main migrated projects:
Source/ReoScript/- core engine library targeting
net10.0 - assembly name:
unvell.ReoScript
- core engine library targeting
Source/ReoScriptRunner/- CLI runner targeting
net10.0 - assembly name:
ReoScript
- CLI runner targeting
Source/TestCase/- xUnit test project targeting
net10.0
- xUnit test project targeting
Additional directories:
Samples/: sample host applications and embedding examplesdocs/: end-user documentationSource/ReoScript/scripts/: embedded built-in ReoScript libraries such ascore.reo,array.reo,debug.reo, andnumber.reo
Not yet migrated into the current .NET 10 solution:
Source/ReoScriptEditor/Source/ReoScriptExtensions/
ReoScript is close to JavaScript, but it is not a drop-in JavaScript runtime. Supported and tested areas include:
- variable declarations with
var if,for,while,switch,try/catch/finally- functions, lambdas, lexical closures
- objects, arrays, JSON,
eval,typeof,instanceof - truthy/falsy conditional semantics
- modules through
import,import ... as, andimportModule(...) - async timers via
setTimeout,setInterval, andclearInterval
ReoScript-specific extensions include:
- object merging with
a + b new Type() { ... }style object initialization- shorthand properties, object spread, and destructuring support
- tag-style syntax such as
<User />
For full syntax and usage details, use the guides in the docs/ directory.
The main host integration surface is ScriptRunningMachine.
Typical host-side operations:
- execute script text with
Run(...) - evaluate expressions with
CalcExpression(...) - expose values with
SetGlobalVariable(...) - read globals back with
GetGlobalVariable(...) - import CLR types with
ImportType(...) - import namespaces with
ImportNamespace(...) - create isolated module objects with
ImportModuleFile(...)
Feature gates are controlled through MachineWorkMode, including:
AllowDirectAccessAllowImportTypeInScriptAllowCLREventBind
For examples, see:
Samples/NativeFunctionExtension/Samples/DirectAccess/Samples/CLRTypeImporting/Samples/ConsoleRunner/
ReoScript includes several runtime behaviors that matter for hosts:
MaxIterationsPerLoopprotects against runawayforandwhileloops- module imports are cached
- async callback and event-handler exceptions can be observed through
ScriptError WorkPathcontrols relative script import resolution
The Samples/ directory contains example integrations, including:
- console execution
- native function extension
- direct access to host objects
- CLR type importing
- property getter/setter integration
- script editor and UI-based demos
MIT License
Copyright (c) UNVELL Inc., Jingwood 2012-2026, All Rights Reserved.