Created
December 2, 2020 06:15
-
-
Save ear7h/18f34e51619093438fab350d5f50fa34 to your computer and use it in GitHub Desktop.
Run a pegjs grammar on an input without compiling it first
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const pegjs = require("pegjs"); | |
const fs = require("fs"); | |
const file = fs.readFileSync(process.argv[2], "utf-8"); | |
const parser = pegjs.generate(file); | |
const input = fs.readFileSync(0, "utf-8"); | |
console.log(parser.parse(input)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment