This is a POC consisting to realize a portable
algorithm interpreter based on the architecture of SoftwareZator, who
compile a code instead of interpret it, but the design patterns are very
The concept is to be able to interpret and debug an algorithm by
using C# at runtime. For a bigger challenge, we want to be able to use it
in a cross-platform project.
It means several things :
I will be unable to use CodeDom
or Roslyn to compile
code and run it.
I will be unable to use the Windows
Debugger as it is not available with WinRT for example, or
even on Linux with Mono if we want to be more cross-platform in
So, in this case, I will make my own CodeDom-like architecture,
And make an interpreter that will
analyze the AlgorithmDom and perform an action
depending of it.
Remark : the code is not very complicated, but
the project architecture is complex because it uses a LOT of
It is just a Proof Of Concept !
There is no Unit Test. There is not a lot of comments and
The simulator is not complete and not very clean ! There miss a
lot of classes in AlgorithmDom compared to the existing CodeDom. It miss
a lot of interpreters, the support of asynchronous simulation...etc. It
is just the minimum !
First of all, we create a Project
that represents a program with classes and methods.
We add our global variables (it is simpler to manage in the
In a method, we add an algorithm. This
algorithm is represented by an Action.
An action, in SoftwareZator,
as in this simulator, it is a part of an algorithm that does
something. For example :
And then, we start the Simulator.
What does the simulator ?
The first step is to create a dictionary that contains a
definition of each variable in the project and their associated
Then, we start to simulate/interpret each Action of the
We display in the Debug the value of each variables of the
project (like Visual Studio does on a breakpoint).
The action will generate an AlgorithmDom
(my cross-plateform CodeDom-like architecture).
And we will ask to the Interpreter
to analyze it and change, for example, the value of a variable if
tha AlgorithmDom is corresponding to an assignation.
In case of exception in the algorithm (for example : I want
to read a file that does not exists), we ask to the current Action
to bring us some tips to fix this error.
Any programming learning app (SoftwareZator,
If you want to download a part of an application from internet
in WinRT and want to run it. I guess that we cannot load an Assembly
at runtime with WinRT. Download an algorithm and simulate it can be a
Please find all my codes on my GitHub and feel
free to read and reuse it as you want.