New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bennu

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bennu

Parser Combinator Library

  • 16.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
530
decreased by-12.4%
Maintainers
1
Weekly downloads
 
Created
Source

Bennu - Javascript Parser Combinator Library

About

Bennu is a library based on Parsec for creating combinatory parsers.

Parser combinators allow complex parsers to be created from a set of simple building blocks. Compared to other parsing techniques, combinatorial parsers can be written more quickly and integrate better with the host language.

Examples

  • parse-ecma - Combinatory parsers for lexing and parsing ECMAScript 5.1
  • khepri - khepri combinatory lexers and parsers.
  • parse-re - ECMAScript regular expression grammar parser and engine using Bennu parser combinators.
  • parse-pn - Very simple polish notation calculator.
  • parse-ecma-incremental - Demonstrates using unmodified parsers to incrementally lex ECMAScript.

Using Bennu

To clone

git clone https://github.com/mattbierner/bennu bennu
cd bennu
git submodule update --init

Dependencies

  • Nu 3.1.x - Small functional, lazy stream library.
  • Seshet 0.1.x - Functional memoization utility.

With Node

Install:

npm install bennu

Use:

var parse = require('bennu').parse;
var text = require('bennu').text;


var aOrB = parse.either(
    text.character('a'),
    text.character('b'));
    
parse.run(aOrB, 'b'); // 'b'

With AMD

Include any AMD style module loader and load Bennu:

<!DOCTYPE html>
<html>
<head></head>
<body>
    <script type="application/javascript" src="require.js"></script>
    <script type="application/javascript">
        requirejs.config({
            paths: {
                'bennu': './dist',
                'nu-stream': './dependencies/nu/dist',
                'seshet': './dependencies/seshet/lib/seshet'
            }
        });
        require(['bennu/parse'], function(parse) {
            ...
        });
    </script>
</body>

Modules

All files live in the top level 'parse' module.

lib/parse - 'parse/parse'

Core functionality. Defines core parsers and data structures for creating and running parsers.

lib/text - 'parse/text'

Parsers for working specifically with text.

lib/lang - 'parse/lang'

Combinatory parsers for ordering parsers, like found in a language.

lib/incremental - 'parse/incremental'

Running parsers incrementally.

Code

Parse.js is written in Khepri. Khepri is an ECMAScript language focused on functional programming that compiles to Javascript. The dist directory contains the generated js library while the Khepri sources are in lib directory.

Keywords

FAQs

Package last updated on 05 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc