KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is it possible to use Javascript to write a compiler that can support other kind of language as scripting? Let's say, I have a piece of HTML. <script language="cpp" id="cppScriptBlock" EntryPoint="main"> int main() { cout << "<h1>CPPHeader</h1>"; } </script> <script language="java" id="javaScriptBlock" EntryPoint="MyJavaClass"> public class MyJavaClass { public final void main() { java.lang.System.out.println("<h1>JavaHeader</h1>"); } } </script> <script language="csharp" id="csharpScriptBlock" EntryPoint="MyCSharpClass "> public class MyCSharpClass { public static void Main() { System.Console.WriteLine("<h1>CSharpHeader</h1>"); } } </script> <script language="javascript"> $("#cppScriptBlock").compileAndRun(); $("#javaScriptBlock").compileAndRun(); $("#csharpScriptBlock").compileAndRun(); </script> And finally generate the following HTML <h1>CPPHeader</h1> <h1>JavaHeader</h1> <h1>CSharpHeader</h1> Is it possible? Alex
Tags (comma-separated)
Save Edits
Cancel