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

ima-parse

v0.0.7

Published

Easy Simple Parser, that only requires a Grammar JSON to output an AST.

Downloads

10

Readme

ima parse

Another parser, but wait! it might be easy to use. The idea is that there are certain limits, that limit the complexity. Perfect for parsing your own DSL or even an existing language, which requires only one Grammar JSON file to generate an AST.

How to use?

alt

  1. Parse the input by giving the Parser the Grammar and the input.
  2. Build the types of the AST and build the builders of that same AST.
  3. Give the output of step 1 and step 2 to the buildContentTree method and receive an object that adheres to the typings created in step 2.

Grammar

A language always starts with a grammar. This grammar contains all the concepts (rules) and how they can be used in a text.

By default, a certain character set is used to distinguish words from numbers and allowed characters from non-recognised ones. Most probably only wordChards will be overridden to allow maybe $ and -.

alt

Grammar Rule definition parts

A rule is a concept in the grammar. This concept consist of certain parts, of which some might be optional:

alt

  • Keyword: required phrase. Not relevant for the compiler
  • Modifiers: list of phrases that can occur. Might be required and singular
  • Identifier: Noun or variable word
  • Number: Integers
  • Text: Any char is allowed here. Useful for string literals/comments etc.
  • Paths: Set of Simple parts (all above). Sort of like a mini-rule that tries multiple paths at once until one or none survives
  • Rules: Reference to one or more rules. Might be required, singular and have a separator (like a comma)

Examples

... todo

Roadmap

  • [ ] Add LSP support
  • [x] Allow choosing your own noun-characters (custom word chars, like a - and a $)
  • [ ] Allow choosing start chars and other chars for custom char options