Console Applications that compile and execute c#, java and c++ code. For c# use Roslyn library and for c++ and java use compilers.
C# code compiling
-
Receive c# code as plain text
-
Compile it using Roslyn (install Microsoft.CodeAnalysis.CSharp nuget package)
- Create Syntax tree
- Include needed libraries
-
Create dynamically dll file that represents console application
-
Create new Process that run the generated dll file in previsous step
- The process open cmd.exe and run the folowing command: dotnet full path to the generated dll file in previous step
-
Give the needed arguments to the running pocess and then read the result of the process(application's output)
Java and C++ code compiling
- Run precess to compile the code using some compilers and then execute compiled codde.