comparison tpc.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 6fe9343b1400
children 2dac67e9d18b
comparison
equal deleted inserted replaced
206:b4a9d4e405c5 207:60eff5f81d9a
90 load(basedir + 'mquery.js'); 90 load(basedir + 'mquery.js');
91 load(basedir + 'peg.js'); 91 load(basedir + 'peg.js');
92 PEG = module.exports; 92 PEG = module.exports;
93 load(basedir + 'parser.js'); 93 load(basedir + 'parser.js');
94 load(basedir + 'compiler.js'); 94 load(basedir + 'compiler.js');
95 load(basedir + 'interp.js');
95 if (backend == 'C') { 96 if (backend == 'C') {
96 load(basedir + 'cbackend.js'); 97 load(basedir + 'cbackend.js');
97 } else if (backend == 'IL') { 98 } else if (backend == 'IL') {
98 load(basedir + 'ilbackend.js'); 99 load(basedir + 'ilbackend.js');
99 } else { 100 } else {
102 103
103 var parsed = parseFile(filename); 104 var parsed = parseFile(filename);
104 if (debugmode) { 105 if (debugmode) {
105 debugprint = print; 106 debugprint = print;
106 } 107 }
108 parsed = parsed.macroexpand(new topenv(includes));
107 toplevel = new topsymbols(includes); 109 toplevel = new topsymbols(includes);
108 switch(backend) 110 switch(backend)
109 { 111 {
110 case 'C': 112 case 'C':
111 var c = parsed.toCModule(); 113 var c = parsed.toCModule();