your looking for possibly a command line library for a console or easy mods, this is no easy task but there is a free library here if you want to get started. It does, however, require a very extensive knowledge of c#. I’m not sure if there is a unityscript( javascript) or boo equivalent. by the way, if your looking to create your own game creator, unity is not the application to do it in.
Web player/iOS - you would probably have to build your own scripting language that was interpreted and executed by your game engine. You cannot emit or compile code on these platforms.
PC/Mac - you can probably get System.Reflection.Emit to create .NET IL assemblies at run time from script typed in - by I doubt the C# compiler services are shipped with Unity by default so you’d probably need to build those in a separate assembly using MonoDevelop and then link it into your game.
Console - no idea
It would be pretty hard work - I’d look for a C# open source C# prep/compilation project and try to link with that if you are targeting PC/Mac standalone.