• Stars
    star
    3,584
  • Rank 12,376 (Top 0.3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 10 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ“œ๐Ÿ”œ๐ŸŒฒ Simple, fast, powerful parser toolkit for JavaScript.

nearley โ†—๏ธ

JS.ORG npm version

nearley is a simple, fast and powerful parsing toolkit. It consists of:

  1. A powerful, modular DSL for describing languages
  2. An efficient, lightweight Earley parser
  3. Loads of tools, editor plug-ins, and other goodies!

nearley is a streaming parser with support for catching errors gracefully and providing all parsings for ambiguous grammars. It is compatible with a variety of lexers (we recommend moo). It comes with tools for creating tests, railroad diagrams and fuzzers from your grammars, and has support for a variety of editors and platforms. It works in both node and the browser.

Unlike most other parser generators, nearley can handle any grammar you can define in BNF (and more!). In particular, while most existing JS parsers such as PEGjs and Jison choke on certain grammars (e.g. left recursive ones), nearley handles them easily and efficiently by using the Earley parsing algorithm.

nearley is used by a wide variety of projects:

nearley is an npm staff pick.

Documentation

Please visit our website https://nearley.js.org to get started! You will find a tutorial, detailed reference documents, and links to several real-world examples to get inspired.

Contributing

Please read this document before working on nearley. If you are interested in contributing but unsure where to start, take a look at the issues labeled "up for grabs" on the issue tracker, or message a maintainer (@kach or @tjvr on Github).

nearley is MIT licensed.

A big thanks to Nathan Dinsmore for teaching me how to Earley, Aria Stewart for helping structure nearley into a mature module, and Robin Windels for bootstrapping the grammar. Additionally, Jacob Edelman wrote an experimental JavaScript parser with nearley and contributed ideas for EBNF support. Joshua T. Corbin refactored the compiler to be much, much prettier. Bojidar Marinov implemented postprocessors-in-other-languages. Shachar Itzhaky fixed a subtle bug with nullables.

Citing nearley

If you are citing nearley in academic work, please use the following BibTeX entry.

@misc{nearley,
    author = "Kartik Chandra and Tim Radvan",
    title  = "{nearley}: a parsing toolkit for {JavaScript}",
    year   = {2014},
    doi    = {10.5281/zenodo.3897993},
    url    = {https://github.com/kach/nearley}
}

More Repositories

1

gradient-descent-the-ultimate-optimizer

Code for our NeurIPS 2022 paper
Python
359
star
2

recreational-rosette

Some fun examples of solving problems with symbolic execution
Racket
109
star
3

tower-of-power

What is hip? Tell me, tell me (if you think you know)
Python
108
star
4

memo

A language for mental models
Jupyter Notebook
28
star
5

designing-perceptual-puzzles-by-differentiating-probabilistic-programs

Supplementary materials for our SIGGRAPH 2022 paper
Jupyter Notebook
27
star
6

shabdle

Shabdle is Wordle in Hindi
Mathematica
24
star
7

neural-ambigrams

Generating digits that are secretly *other* digits doing handstands
HTML
19
star
8

acting-as-inverse-inverse-planning

Code for our SIGGRAPH 2023 paper, "Acting as Inverse Inverse Planning"
Jupyter Notebook
16
star
9

chaos-game-fractal-foliage

Code for "Learning to Play the Chaos Game: Dreaming of fractal foliage by differentiating iterated function systems"
Jupyter Notebook
14
star
10

Snapin8r

A Scratch 2.0->Snap! converter
JavaScript
13
star
11

eddie

An automatic first-order theorem prover in Haskell
Haskell
12
star
12

emo.7

The man page for emoticons.
Groff
9
star
13

torchsaber

Elegant dimensions for a more civilized age
Python
8
star
14

kesar

A Python library for quickly building human subject studies
Python
8
star
15

shock

It's simpleโ€ฆ it's staticโ€ฆ it's shock!
JavaScript
8
star
16

jigsaw

An Escher-esque jigsaw puzzle generator
Standard ML
8
star
17

prufrock

A literary proof assistant built on the affine calculus of inductive constraints
Standard ML
8
star
18

gifblocks

Make animated GIFs from your Scratch projects!
HTML
8
star
19

haskell-lambda-calculus

A simple lambda calculus interpreter in Haskell.
Haskell
7
star
20

hamelin

Revenge of the The Py'd Piper
Python
7
star
21

lowtex

Low-tech text processing
JavaScript
7
star
22

baobab

Interactive Fiction with Racket and love
JavaScript
6
star
23

voxel

Yet another raytracer, because we don't have enough of those already
Scheme
5
star
24

sublime-nearley

A nearley syntax plugin for TextMate/Sublime Text
Makefile
5
star
25

softraxterizer

A small softras implemented in JAX
Python
4
star
26

hell

Because http://xkcd.com/724/
JavaScript
4
star
27

hootow-hyperlapse

Using classic computer vision algorithms to align hundreds of images of Hoover Tower
Jupyter Notebook
4
star
28

quackoverflow

Meow.
JavaScript
3
star
29

boxcars

Lively box-and-pointer diagrams for Racket.
Racket
3
star
30

bellhop

A simple, informative bell schedule app.
JavaScript
3
star
31

optimally-framing-roger-rabbit

accelerating accelerators with differentiable kD-trees
Python
3
star
32

englipsum

Usable loremtext
JavaScript
2
star
33

Legible

Regexes for Humans
JavaScript
2
star
34

Human

Humanist documentation
Python
2
star
35

ketchup

A temporal RSS proxy
JavaScript
2
star
36

turtlegrad

Bidirectional programming by gradient descent
JavaScript
2
star
37

scotty

Specify Characters On a TTY - Readline for binary input
C
2
star
38

watchat

Racket
2
star
39

jeopardy-wagering-under-uncertainty

Python
1
star
40

indexme

Quick, portable, versatile directory listing generator
Shell
1
star
41

jokebot

A simple demo IRC bot in Python
Python
1
star
42

poison-ivy

Create a graphical representation of dependency relationships between Ivy conjectures.
Python
1
star
43

generative-adversarial-web-development

Substanceโ€ฆ and style!
HTML
1
star
44

lagrange-climbs-a-hill

Interpolating Lagrangian mechanics by AD and gradient descent
Python
1
star
45

bentley-blizzard-blossoms

A frosty MNIST alternative :)
Jupyter Notebook
1
star