000 Overview

Petro Protsyk edited this page Mar 31, 2015 · 1 revision


S# is a weakly-typed dynamic language and run-time infrastructure to make your applications extendable, customizable and highly flexible. It allows introducing expressions and large code blocks evaluation within your applications in the similar way Microsoft Office deals with VBScript, gives you possibilities providing rich formula evaluation capabilities like it can be seen in MS Excel and other office applications.

The key principles of S# are: simplicity, efficiency, intuitive. The S# run-time has been designed to be easily hosted by applications. Minimum script execution scenario requires two lines of code! The important part of S# is its well-defined extendable run-time engine together with the application programming interface that allows full bi-directional communication between script and application code. In particular it is easy to extend S# by embedding external functions and functional objects, shared static or dynamic variables, operator handling and type filters from the host application. Moreover the execution semantics of some language constructs has extensibility mechanisms available externally. This enables developers to create user-friendly executable business/domain specific languages on S# basis.

S# can work in single-expression mode in order to execute string expressions to values. This is especially helpful when application should allow users executing only light-weight portions of the functionality. S# is a pure .NET interpreted language completely written in C#.

Currently S# is compatible and runs on top of the following platforms:

  • Microsoft .NET 4
  • Microsoft .NET 3.5 (SP1)
  • Microsoft Silverlight > 3
  • Microsoft .NET Compact Framework
  • Microsoft XNA Framework
  • MONO

This means that S# run-time can be hosted by applications based on .NET like Console, Windows Forms, ASP.NET, Silverlight 2 and 3, Windows Presentation Foundation (WPF), XNA (both PC and XBox scenarios) and MONO (Linux).

With respect to the DLR and languages like IronPython, S# is:

  • Designed to be easily embedded into applications (several lines of code required to evaluate script);
  • Highly extensible grammar and language (new functions, constants, variables can be added easily);
  • Rich and controlled communication between script and application code in both directions;
  • Supports interaction with native .NET code;
  • Works in single-expression mode when executing string expressions to values;
  • No code emitting, CodeDom or background compilation, 100% interpreted language (own Virtual Machine and Debugging is in progress);
  • Totally in-memory execution, does not require temp files, local system access, etc;
  • C#-like language is designed to be familiar for .NET and Java developers; easy to study for non-developer users;
  • Various of platforms are supported (.NET/.NETCF/Mono; WinForms, ASP.NET, WPF, Silverlight, XNA);
  • Expressions and scripts can be sent across the wire and executed on a remote machine;
  • Weakly-typed as IronPython/IronRuby for .NET


The idea of Script .NET was born 17 September 2007.

  • First alpha was released 03 October 2007.
  • 04 October – CodeProject Article submitted.
  • 21 October – WikiPedia article.
  • 19-20 Script.NET has been announced on Microsoft community forums and Google groups.
  • 22 October, CodePlex project had been launched.
  • 17 January 2008, DLR implementation of the language started.
  • 07 February 2008, The First working prototype of DLR MyL released.
  • 22 February 2008, Script.NET grammar was implemented with Irony.
  • 27 March 2008, Script.NET run-time was ported on Irony platform.
  • 14 April 2008, The work on this help file started.
  • 06 October 2010, Version 3.0 beta for .NET 4 platform


  • Run-time verification in Script.NET, TAAPSD'08 Conference
  • Composition-Nominative Approach in Script.NET (in Russian, Edited)
  • Presentation about Script.NET (ukr)
  • Program verification using CNLS
  • Script.NET mentioned in Roman Ivantsov's talk on "Lang .NET Symposium 2009" about Irony compiler kit.

Getting Started

All you need to start working with Script.NET is to add reference to Scripting.SSharp.dll,

Example 1 (C# code)

using Scripting.SSharp;



Example 2

using Scripting.SSharp;

RuntimeHost.AddType("MessageBox", typeof(MessageBox));

Script s = Script.Compile(
   "MessageBox.Show('Hello .NET! This is Script .NET');");


Example 3

Bubble sort in S#:

a=[17, 0, 5, 3,1, 2, 55];

for (i=0; i < a.Length; i=i+1)
 for (j=i+1; j <  a.Length; j=j+1)
  if (a[i] > a[j] )
   temp = a[i]; 
   a[i] = a[j];
   a[j] = temp;

s = 'Results:';
for (i=0; i < a.Length; i++)
  s = s + ',' + a[i];

Example 4

Factorial, recursive functions:

function factorial(n){
  if (n==1) return 1;
  else return n*factorial(n-1);

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.