GithubHelp home page GithubHelp logo

webthingsio / dissolve-chunks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from simenkid/dissolve-chunks

0.0 1.0 0.0 44 KB

A declarative parser generator based on dissolve.

License: Other

Makefile 0.56% JavaScript 99.44%

dissolve-chunks's Introduction

Dissolve-chunks

A declarative parser generator based on dissolve.

Travis branch npm npm


Documentation

Please visit the Wiki.


Overview

With dissolve-chunks (DChunks), you can make a parser by defining the parsing rules for each chunk of the binaries. This means that you need not to write your parsing codes from the beginning to the end of the binaries. You can separate the targeting data into smaller chunks, and then define the parsing rules for each of them. After all rules are ready, you can call the chainable method join() to sequentially connect all your rules . Finally, just call compile() to get your parser.

Here is an pseudo example:

var chunk1_rules = [ rule1, rule2, rule3 ],
    chunk2_rules = [ rule4, squash([ rule5_1, rule5_2 ]) ],
    chunk3_rule = squash([ rule6, rule7 ]),
    chunk4_rule = rule8,
    chunk5_rule = squash('key_name', [ rule9, rule10 ]);

var parser = DChunks().join(chunk1_rules).join(chunk2_rules)
                     .join(chunk3_rule).join(chunk4_rule)
                     .join(chunk5_rule).compile();

parser.on('parsed', function (result) {
    console.log(result);
});

Features

  • Making your parser in a declarative way.
  • More manageable by cutting the targeting data into smaller chunks and defining the rules for each of them.
  • You can squash some rules into a single rule by using squash([name,] rules). If name is specified while squashing, the DChunks will automatically put the parsed result under that namespace. It's handy.
  • Making a parser is mostly just about declaring rules. Integrating and compiling the parsing rules is easy.

Installation

$ npm install dissolve-chunks --save


Usage

See Usage on the Wiki.


License

Licensed under MIT.

dissolve-chunks's People

Contributors

simenkid avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.