-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·47 lines (35 loc) · 1.26 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env node
const path = require("path");
const version = require("./package.json").version;
const compile = require("pilcom").compile;
const F = require("pilcom").F; //is actually ffjavascript.F1Field((1n<<64n)-(1n<<32n)+1n );
const Piller = require("./Piller.js");
//Constants declarations
const checkerPath = './checkers/';
const yargs = require("yargs")
.version(version)
.usage("piller <main.pil>");
const argv = yargs.argv;
async function compileAndRun() {
//Args processing
const inputFile = argv._[0];
if (!inputFile) {
yargs.showHelp("log");
return;
}
//Compiling PIL to json
const fullFileName = path.resolve(process.cwd(), inputFile);
const ctx = await compile(F, fullFileName, null, {}); // config is set to {} for now, maybe will change
//initialize piller with ctx
let piller = new Piller(ctx, "Main", compile, F);
//loop the checkers and run them
const checkerFiles = require(checkerPath);
for (let file of checkerFiles) {
let checker = require(path.join(process.cwd(), checkerPath, file));
console.log("\n\n------ %s -------", checker.name);
await checker(piller); //run the checker
}
}
compileAndRun().then(() => {
console.log("PILLER FINISHED");
})