Mercurial > repos > tabletprog
view tpc.js @ 36:3b0503a67165
Add scripts for building programs via C using d8 rather than a browser
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 10 Jul 2012 19:22:19 -0700 |
parents | |
children | 27a2167663dd |
line wrap: on
line source
var module = {exports: {}}; var PEG; if (arguments.length < 1) { print('usage: d8 tpc.js -- filename'); os.exit(); } else { compileFile(arguments[0]); } function compileFile(filename) { var text = read(filename); load('peg.js'); PEG = module.exports; load('parser.js'); load('compiler.js'); load('cbackend.js'); var parsed = parser.parse(text); var c = parsed.toCModule(); print(c); }