import * as fs from "fs"; import { context } from "./js/ctx.js"; import { execute } from "./js/execute.js"; import { LISPcmd, LISPstring, createType } from "./js/lexer.js"; var path = process.argv[2]; var pathout = process.argv[3]; if (!path || !pathout) { console.log("PLease this Schema: node ToAs.js [path] [pathout]"); process.exit(); } var file = fs.readFileSync(path).toString(); var data = new LISPcmd("(\n" + file + "\n)", 0, 0); let code = ""; var ctx = new context(); for (var i = 0; i < data.length; i++) { let { code: c, type } = execute({ data: data[i], ctx }); code += c; } let result = ctx.build(); result+=code; console.log(result); fs.writeFileSync(pathout, result); console.log(`Finished compiling in ${Math.round(performance.now()) / 1000}sec. Assembly saved to: ${pathout}`);