UNPKG

coffee-fmt

Version:

a `gofmt` inspired Coffeescript formatter/beautifier.

40 lines (35 loc) 823 B
/** * CodeGenerator.js * */ var Backend = require('./Backend').Backend , _ = require('lodash') , COMPILER_SUMMARY = require('../constants/MessageTypes').get("COMPILER_SUMMARY") , process ; /** * Process the intermediate code and the symbol table generated by the * parser to generate machine-language instructions. * @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() , instructionCount = 0 , elapsedTime ; elapsedTime = (new Date().valueOf() - startTime)/1000; this.sendMessage({ type: COMPILER_SUMMARY , arguments: [ instructionCount , elapsedTime ] }); }; exports.CodeGenerator = function () { return _.extend(new Backend(), { process: process }); };