(function(global) {
    'use strict';

    HTMLElement.prototype.on = function() {
        this.addEventListener.apply(this, arguments);
    };

    function $(selector) {
        return document.querySelector(selector);
    }

    function $$(selector) {
        return document.querySelectorAll(selector);
    }
    var timeOutNum = 1000,
        timeOutValue = 0;

    function runProgram() {
        window.clearTimeout(timeOutValue);
        if (true)
            return;

        // foo

        timeOutValue = window.setTimeout(runProgram, timeOutNum);
    }


    (function(id) {
        var i, j;
        var tab = document.getElementById(id);
        var thead = tab.querySelector('thead');
        var tbody = tab.querySelector('tbody');
        var tr, td;
        for (i = 0; i < 3; i++) {
            tr = document.createElement('tr');
            tr.id = "row-" + i;
            for (j = 0; j < 30; j++) {
                td = document.createElement('td');
                td.textContent = 0;
                td.id = "cell-" + (i * 30 + j);
                tr.appendChild(td);
            }
            tbody.appendChild(tr);
        }
    })('rams');

    $('#program-compile').on('click', function() {
        var tarea = $('#program-input');
        var programSrc = tarea.value;
        tarea.value = '';
        var program = $('#program');
        program.textContent = programSrc;
    });

    $('#exec-speed').on('change', function() {
        timeOutNum = this.value;
    });
    $('#program-step').on('click', function() {
        runProgram();
    });

})(this);

@@ -358,16 +358,40 @@
 alue = 0
+,%0A        running = true
 ;%0A%0A    f
@@ -511,16 +511,41 @@
 // foo%0A%0A
+        if (running)%0A    
         
@@ -1619,16 +1619,225 @@
 %0A    %7D);
+%0A    $('#program-pause').on('click', function() %7B%0A        running = !running;%0A        if (!running) %7B%0A            window.clearTimeout(timeOutValue);%0A        %7D else %7B%0A            runProgram();%0A        %7D%0A    %7D);
 %0A%0A%7D)(thi

Add pausing and resuming