PEG.js is a simple parser generator for JavaScript that produces fast parsers with excellent error reporting. You can use it to process complex data or computer languages and build transformers, interpreters, compilers and other tools easily.
PEG.js offers tracing support to help analyze parser issues with a grammar. The feature is very helpful, but it's not available yet on the version that's published to npm
, it's not well-advertised, and not well-documented. This gist explains how to take advantage of PEG.js tracing support.
When you generate your parser, make sure you supply the trace
option set to true. If using gulp
, do something like this:
var peg = require('gulp-peg');
var paths = {