coffee-fmt
Version:
a `gofmt` inspired Coffeescript formatter/beautifier.
43 lines (37 loc) • 848 B
JavaScript
/**
* Executor.js
*
*/
var Backend = require('./Backend').Backend
, _ = require('lodash')
, INTERPRETER_SUMMARY = require('../constants/MessageTypes').get("INTERPRETER_SUMMARY")
, process
;
/**
* Process the intermediate code and the symbol table generated by the
* parser to execute the source program.
* @param iCode the intermediate code.
* @param symTab the symbol table
* @throws Error if an error occurred.
*/
process = function (iCode, symTab) {
var startTime = new Date().valueOf()
, executionCount = 0
, runtimeErrors = 0
, elapsedTime
;
elapsedTime = (new Date().valueOf() - startTime)/1000;
this.sendMessage({
type: INTERPRETER_SUMMARY
, arguments: [
executionCount
, runtimeErrors
, elapsedTime
]
});
};
exports.Executor = function () {
return _.extend(new Backend(), {
process: process
});
};