You ll need to host all sorts of compilers you d like to support and use their APIs. If a compiler doesn t expose an API, you d need to use System.Diagnostics.Process
to launch it and grab the output for parsing.
This is far from a trivial task though.
If you re confident you need this, ask yourself several questions.
- Which languages, platforms and languages do you plan to support? Python and Ruby, do you mean .NET versions of them or do you want to use their standard compilers? Which versions?
- Do these compilers have any public APIs? Will you need to run them as executables?
- If the site is going to be used concurrently by many users, how do you plan to distribute the load? Compiling is an intensive process and having a lot of people doing it will overload your server. Also note that compilation always takes time so you ll need to think how to present it to user. Do you want it to start immediately or do you want to put users in a queue?
- What is the user coding scope? Is user input limited to one method contents, or does the user have to write the whole file? Is any code added by system by default? How do you resolve the references e.g. for C# code? Are some libraries referenced by default?
And this is just the tip of the iceberg.
Answering your comment, yes, there is a compiler API for C# and VB .NET which is called CodeDOM.
There s plenty of information about it on the net. You may want to check out this question as well.