UNPKG

827 BJavaScriptView Raw
1#!/usr/bin/env node
2
3var parser = require('./folproof-parser.js').parser;
4var verifier = require('./folproof-verifier.js').Verifier;
5var fs = require('fs');
6var path = require('path');
7
8var version = require('./package.json').version;
9
10var opts = require("nomnom")
11 .script('folproof')
12 .option('file', {
13 flag: true,
14 position: 0,
15 help: '.fol source file'
16 })
17 .parse();
18
19exports.main = function() {
20 if (opts.file) {
21 var raw = fs.readFileSync(path.normalize(opts.file), 'utf8');
22 var ast, result;
23 try {
24 ast = parser.parse(raw);
25 result = verifier.verifyFromAST(ast);
26 console.log(result);
27 } catch(ex) {
28 //console.log(JSON.stringify(ast, null, 2));
29 console.log("ERROR", ex.toString());
30 }
31 }
32};
33
34if (require.main === module)
35 exports.main();