Mercurial > repos > tabletprog
diff compiler.js @ 207:60eff5f81d9a
Basic implementation of macros is now working
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 19 Nov 2013 22:02:11 -0800 |
parents | d2e0664ba73e |
children | 2557ce4e671f |
line wrap: on
line diff
--- a/compiler.js Wed Oct 23 19:10:03 2013 -0700 +++ b/compiler.js Tue Nov 19 22:02:11 2013 -0800 @@ -13,7 +13,7 @@ modulefile.prototype.populateSymbols = function (toplevel) { if (!this.ast) { - this.ast = parseFile(this.path + '/' + this.file); + this.ast = parseFile(this.path + '/' + this.file).macroexpand(new topenv(toplevel.moduledirs)); this.ast.populateSymbols(toplevel); } }; @@ -22,6 +22,7 @@ if (!this.ast) { var self = this; get(this.path + '/' + this.file, function(data) { + //TODO: macro expand in the async case self.ast = parser.parse(data.responseText); self.ast.populateSymbols(toplevel); whenDone(); @@ -48,6 +49,7 @@ var toplevel = new topsymbols([]); function topsymbols(moduledirs) { + this.moduledirs = moduledirs; this.names = null; this.used = {}; this.nextmodulenum = 0;