title: Possible to write a Compiler with Javascript?
body: <p>Is it possible to use Javascript to write a compiler that can support other kind of language as scripting?</p>
  
  <p>Let's say, I have a piece of HTML.</p>
  
  <pre><code>&lt;script language="cpp" id="cppScriptBlock" EntryPoint="main"&gt;
      int main() {
          cout &lt;&lt; "&lt;h1&gt;CPPHeader&lt;/h1&gt;";
      }
  &lt;/script&gt;
  
  &lt;script language="java" id="javaScriptBlock" EntryPoint="MyJavaClass"&gt;
      public class MyJavaClass {
          public final void main() {
              java.lang.System.out.println("&lt;h1&gt;JavaHeader&lt;/h1&gt;");
          }
      }
  &lt;/script&gt;
  
  &lt;script language="csharp" id="csharpScriptBlock" EntryPoint="MyCSharpClass "&gt;
      public class MyCSharpClass {
          public static void Main() {
              System.Console.WriteLine("&lt;h1&gt;CSharpHeader&lt;/h1&gt;");
          }
      }
  &lt;/script&gt;
  
  
  &lt;script language="javascript"&gt;
      $("#cppScriptBlock").compileAndRun();
      $("#javaScriptBlock").compileAndRun();
      $("#csharpScriptBlock").compileAndRun();
  &lt;/script&gt;
  </code></pre>
  
  <p>And finally generate the following HTML</p>
  
  <pre><code>&lt;h1&gt;CPPHeader&lt;/h1&gt;
  &lt;h1&gt;JavaHeader&lt;/h1&gt;
  &lt;h1&gt;CSharpHeader&lt;/h1&gt;
  </code></pre>
  
  <p>Is it possible?</p>
  
  <p>Alex</p>