Skip to content

🌀 Gulp task to build a PEG.js parser from multiple .peg grammar source files

Notifications You must be signed in to change notification settings

americademy/gulp-kidscript-pegjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-kidscript-pegjs

This gulp plugin will generate a pegjs parser based on various opinions around how our grammer is written and organized

example usage

// gulpfile.babel.js

import pegjs from 'gulp-kidscript-pegjs';

function buildParser() {
  /*
    switch print to true to output the combined grammar, this 
    is useful for testing on the interactive tool on their website
    
    trace can be true or false to generate a parser which supports tracing
  */ 
  let tracer = null;
  let options = {
    print: false,
    trace: false
  };
  return gulp.src(['grammar/header.js', 'grammar/index.peg', 'grammar/**/*.peg'])
    .pipe(pegjs('peg_parser.js', options))
    .pipe(gulp.dest('./src/parser'));
};

// generate the combined grammer, and build the parser
gulp.task('build-parser', buildParser);

About

🌀 Gulp task to build a PEG.js parser from multiple .peg grammar source files

Resources

Stars

Watchers

Forks

Packages

No packages published