comparison tpc.js @ 205:6fe9343b1400

Some minor work on creating an IL backend based on the C backend
author Mike Pavone <pavone@retrodev.com>
date Sun, 13 Oct 2013 20:23:08 -0700
parents 5e34563f90ae
children 60eff5f81d9a
comparison
equal deleted inserted replaced
204:a8dffa4d4b54 205:6fe9343b1400
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 if (backend == 'C') { 95 if (backend == 'C') {
96 load(basedir + 'cbackend.js'); 96 load(basedir + 'cbackend.js');
97 } else if (backend == 'IL') {
98 load(basedir + 'ilbackend.js');
97 } else { 99 } else {
98 load(basedir + 'jsbackend.js'); 100 load(basedir + 'jsbackend.js');
99 } 101 }
100 102
101 var parsed = parseFile(filename); 103 var parsed = parseFile(filename);
106 switch(backend) 108 switch(backend)
107 { 109 {
108 case 'C': 110 case 'C':
109 var c = parsed.toCModule(); 111 var c = parsed.toCModule();
110 break; 112 break;
113 case 'IL':
114 var c = parsed.toILModule();
111 case 'JS': 115 case 'JS':
112 var c = makeJSProg(parsed); 116 var c = makeJSProg(parsed);
113 break; 117 break;
114 default: 118 default:
115 print('Backend', backend, ' not recognized'); 119 print('Backend', backend, ' not recognized');