
var cobs = require('../..'),
    fs = require('fs');

var runtime = {
    display: function(msg) {
        console.log(msg);
    }
}

function runFile(filename) {
    var text = fs.readFileSync(filename).toString();
    var parser = new cobs.Parser(text);
    var program = parser.parseProgram();
    cobs.run(program.command.compile(program), runtime, program);
};

process.argv.forEach(function(val) {
    if (val.slice(-5) == ".cobs" || val.slice(-4) == ".cob")
        runFile(val);
});



var cobs = require('../..'),
    fs = require('fs');

var runtime = {
    display: function(msg) {
        console.log(msg);
    }
}

function runFile(filename) {
    cobs.compileProgramFile(filename).run(runtime);
};

process.argv.forEach(function(val) {
    if (val.slice(-5) == ".cobs" || val.slice(-4) == ".cob")
        runFile(val);
});


Refactor hellopgm sample to use compileProgramFile