npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jspeg

v0.2.1

Published

Parsing Expression Grammar engine for Javascript, written in Typescript, descending from peg.js

Downloads

20

Readme

jspeg

jspeg is a Parsing Expression Grammar parser for Javascript, written in Typescript, descending from peg.js by David Majda.

The goal of jspeg is to provide a modern PEG environment for contemporary Javascript.

What is a Parsing Expression Grammar?

Parsers Are Hard ™.

There are lots of ways to go about writing parsers:

  • LL, LR, LALR
  • Recursive descent, Pratt
  • Earley, Combinator
  • Lenses
  • Et cetera

Lots of these have advantages and disadvantages. Some are faster; some can't express certain languages; some need more computer resources; some are easier; and so on. Mostly these are trade-offs; the fast one is the difficult one, et cetera. (Of course they are; if one parser won on all metrics, that'd be the one everyone used.)

Why choose PEGs in general?

PEGs strike a pretty good balance:

  1. They're comparatively easy to write and maintain
  2. They usually give great error messages
  3. Their resource use isn't huge, though they're a little RAM hungry
  4. They're a little above-average in speed, even on large documents
  5. They can conveniently express most languages

PEGs are a fairly middle of the road choice. They're good-ish for most things.

Why choose JsPeg?

The library this library descends from, peg.js, did a remarkably good job of finding this balance, and providing stable, reliable tooling to do real world work.

Unfortunately, after a decade, David found other priorities, and JavaScript has moved on in that time. The new maintainer also found other interests, but did not pass the torch. The parent library has been largely unchanged for almost six years, and the domain and project have not been recovered.

In the meantime, this is one of the most important pieces of Javascript tooling around. In most cases there is not a sensible replacement.

As such, a fork was required.

JsPeg is a modernization. It's sort of a fork - the github repo is not inherited; only the code. The code has been static for half a decade; cutting the history away, and the tooling around it built for hosting that doesn't exist anymore should be discarded wholesale.

In the meantime, some of peg.js' most productive features, such as its IDE, should be re-written in modern tooling, like embedded vs.code.

But the parser generator?

It's a gem. Let's save it. All your grammars should be maintained.

It's not a new peg engine.

It's the peg engine you know, love, and use, re-tooled for a modern world.