Coder Social home page Coder Social logo

guru's Introduction

Guru

A fancy, general-purpose, modular, and reusable parser.

Guru is a general purpose parsing library for Node.js, that can take advantage of the modular ecosystem, and rely on a lot of native components to be lightweight.

It uses a Reader class to maintain the ability to take abstract input, and the Parser class relies on this. With that in play, the Parser can be reused multiple times to parse many different things... For instance, you can use the same Parser class to lex an input, as well as to analyze tokens outputted from your previous parser.

Installation

$ npm install --save jamen/guru

Usage

import { Parser } from 'guru';
import fs from 'fs-promise';
import { tokenize, transform, resolve } from 'my-lang';

fs.readFile('my-file.txt')
.then(buffer => new Parser(tokenize).parse(buffer))
.then(tokens => new Parser(transform).parse(tokens))
.then(tokens => new Parser(resolve).parse(tokens))
.then(buffer => {
  // ...
});

Credits

jamen
Jamen Marzonie

guru's People

Contributors

jamen avatar

Stargazers

 avatar

Watchers

 avatar

guru's Issues

AST support in Reader

The new Writer class (#1) will allow for AST output (nested arrays), Reader should be able to handle trees as well.

Because Reader is more of a blueprint for strictly linear structures, it might be extended into a separate ASTReader class.

Custom output methods.

Guru, being a general-purpose parser, should have the ability to have a custom method of outputting. Much like how you can load a custom Reader.

Right now Guru only allows linear output into an array, which is on the Parser class.

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.