aboutsummaryrefslogtreecommitdiff
path: root/src/compiler.html
blob: 76d2dc337ca74bdbaaab1c2ffb4def9eeba31695 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<html>
<body>
<h2>Run the emscripten compiler in a web page, just for laughs</h2>
Open the web console to see stderr output
<hr>
<pre id="output"></pre>
<script>
  arguments = ['', 'hello_world.ll'];

  var outputElement = document.getElementById('output');
  var compilerOutput = '';
  print = function(x) {
    //outputElement.innerHTML += x;
    compilerOutput += x;
  };

  // For generated code
  var Module = {
    print: function(x) {
      outputElement.innerHTML += x;
    }
  };
</script>
<script src="compiler.js">
</script>
<input type="button" value="run!" onclick="eval(compilerOutput)">
</body>
</html>