Is it possible?
To quote Rev. Lovejoy from The Simpsons, the “short answer is no” with “if.” The long answer is yes, but “but.”
No , it’s currently not possible to use the technology currently used.
Yes , but it requires that you roll your own server, which will act as a spacer, separating the various sections of code and sending them to the required parsers + compilers, and then combine these separate sections to display the page.
Edit: @Shantanu: My pleasure. The implementation is entirely up to you, as I have not investigated anything like this.
Ultimately, I think this is not the most productive thing, since you are likely to encounter a lot of problems.
Biggest creature: Code from one language will not have a clue about what is being done in other languages.
i.e. If you have a variable defined with values in your ASP, the Java or PHP versions will not be aware of this without enormous effort, not to mention the fact that they will not be able to access memory from each other completely.
However, if you want to go down this route, I suggest you look into a parser generator, such as ANTLR . This will help you write a parser that can search for your special tags (note: this can be done using regular expression or parsing with manual rotation, if necessary).
After you split the code, you will want to send it to the compilers for each language from which you can get text output. Once you have this text, it should be all html + javascript, which can then be combined together to display the page.
I will say that if you want 3 languages to interact, you will create a HUGE project. It may be easier to use the .Net infrastructure and write the PHP and JAVA languages for it (which probably already exist), which allows you to abandon the creation of the entire server package.