ringneck / index.htm

<!doctype html>
<html>
  <head>
    <title>Ringneck - Compile PASM to JS</title>
    <meta charset="utf-8" />
    <script src="ringneck.js"></script>
    <script src="library-export.js"></script>
    <link href="http://kevinburke.bitbucket.org/markdowncss/markdown.css" rel="stylesheet" />
    <style>
      textarea {
        display: block;
      }
      h1 {
        color: #10BB29;
     }
    </style>
  </head>
  <body>
    <h1>&laquo; Ringneck &raquo;</h1>
    <p>Ringneck is a very basic compiler from
      <a href="http://en.wikipedia.org/wiki/Parrot_assembly_language">Parrot Assembly Language</a> (PASM) to
      JavaScript. It only implements a small subset of PASM.</p>
    <form id="compile" action="#">
      <h2>PASM input</h2>
      <p>See the <a href="http://docs.parrot.org/parrot/latest/html/ops.html">opcode docs</a> for help.</p>
      <textarea id="input" rows="10" cols="70">  set     I1, 1
REDO:
  gt      I1, 10, END
  print   I1
  print   " "
  inc     I1
  branch  REDO
END:
  print "\n"
  end</textarea>
      <input type="submit" value="Execute" />
      <h2>Output</h2>
      <p>From running the program.</p>
      <textarea id="output" rows="10" cols="70" disabled="disabled"></textarea>
      <h2>Compiled</h2>
      <p>The compiled JavaScript.</p>
      <textarea id="compiled" rows="20" cols="70" disabled="disabled"></textarea>
    </form>
    <script>
      var writeOutput = function(line) {
        var output = document.getElementById('output');
        output.value += line + '\n';
      };
      (function() {
        var compile = function(event) {
          var compiled = document.getElementById('compiled'),
              output = document.getElementById('output'),
              input = document.getElementById('input'),
              script;
          compiled.value = '';
          output.value = '';
          try {
            compiled.value = compilePASM(library, input.value, 'writeOutput');

            script = document.createElement('script');
            script.innerHTML = compiled.value;
            document.body.appendChild(script);
          } catch(e) {
            compiled.value = e;
          }
          if(event) event.preventDefault();
        };
        document.getElementById('compile').addEventListener('submit', compile);
        compile();
      })();
    </script>
  </body>
</html>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.