Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 98fc9409d3
Fetching contributors…

Cannot retrieve contributors at this time

executable file 23 lines (16 sloc) 0.591 kb
#!/usr/bin/env node
var Canopy = require('../lib/canopy'),
fs = require('fs');
try {
var startTime = new Date().getTime(),
inputFile = process.argv[2],
outputFile = inputFile.replace(/\.peg$/, '.js'),
grammar = fs.readFileSync(inputFile).toString(),
parser = Canopy.compile(grammar),
endTime = new Date().getTime();
fs.writeFileSync(outputFile, parser);
console.log('Generated parser in ' + outputFile);
console.log('Completed in ' + ((endTime - startTime) / 1000) + 's');
} catch (e) {
console.error(e.message);
}
Jump to Line
Something went wrong with that request. Please try again.