codegen and dropped the useless walker

This commit is contained in:
Mihai Bazon
2012-08-16 18:11:04 +03:00
parent c0ba9e2986
commit 7f273c3b89
4 changed files with 450 additions and 298 deletions

View File

@@ -12,9 +12,9 @@
};
load_global("./utils.js");
load_global("./output.js");
load_global("./ast.js");
load_global("./parse.js");
load_global("./output.js");
///
@@ -23,11 +23,13 @@
var ast = parse(fs.readFileSync(filename, "utf8"));
console.timeEnd("parse");
console.time("walk");
var w = new TreeWalker(function(node){
console.log(node.TYPE + " [ start: " + node.start.line + ":" + node.start.col + ", end: " + node.end.line + ":" + node.end.col + "]");
});
ast.walk(w);
console.timeEnd("walk");
// console.time("walk");
// var w = new TreeWalker(function(node){
// console.log(node.TYPE + " [ start: " + node.start.line + ":" + node.start.col + ", end: " + node.end.line + ":" + node.end.col + "] " + node.name);
// });
// ast.walk(w);
// console.timeEnd("walk");
//console.log(JSON.stringify(ast));
})();