kishore asked:
Is it possible in another languages like C, Java?
Interesting question.
Basically, no. Implementation of such thing in compiler languages is generally impossible, by apparent reasons: the function you may want to use needs to be compilers, as well as its call.
However, in certain technologies, something analogous is possible, but, technically, this is a very different thing, related to compilation.
For example, .NET supports compilation during runtime, and the framework guarantees the presence of some compilers. But the solution is conceptually very different: you compile some code with all the attributes of complete project into an assembly, then load this assembly, finds the implemented interface and instantiate some implementing class using reflection, and than use this instance to execute some code, even in the same process which you used in the compilation in first place. But the problems are only started here: if you want to do this over and over (in the same process), you will have a memory leak, because it's impossible to unload a loaded assembly. The solution is to have a separate application domain in the same process, and each time create it and delete the whole domain. But then you have to work through the domain boundary, which is not so easy, because the domains are isolated, so you would need to use IPC. This way, you can create a "compiling calculator" for anything. This is a very interesting stuff, I've done all that, and more. But, as you can see, this is very, very different from the approach of the interpretive languages.
—SA