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 🙏

© 2026 – Pkg Stats / Ryan Hefner

plgg-ir-syntax

v0.0.1

Published

Minimal S-expression syntax library for the plgg-ir family. Parses source text into position-aware syntax trees and prints syntax trees back into a canonical textual representation without assigning domain-specific meaning. Built on plgg-parser combinator

Readme

plgg-ir-syntax

UNSTABLE - Experimental study work. Part of the plgg monorepo.

A minimal S-expression syntax library for the plgg-ir family, built on plgg and plgg-parser. It parses source text into position-aware syntax trees and prints trees back into a canonical textual representation — and it assigns no domain meaning: this layer does not know what entity or policy mean.

source text ──parseSexps──▶ ReadonlyArray<Sexp>  (every node carries a SourceRange)
Sexp tree   ──printSexp───▶ canonical text       (deterministic layout)

Why this package exists

The plgg-ir family gives LLM agents a restricted, statically verifiable intermediate representation: an agent generates a Lisp-style Domain Manifest, the toolchain verifies and normalizes it, and consumers such as plggmatic interpret the canonical result deterministically. This package is the family's lowest layer — the source structure:

plgg ── plgg-parser ── plgg-ir-syntax ── plgg-ir-language (next) ── plgg-ir-manifest

What it provides

  • Sexp — a Box-union syntax tree: symbols, strings, numbers, booleans, lists; every node carries a half-open SourceRange (offset + 1-based line/column).
  • parseSexps(source)Result<ReadonlyArray<Sexp>, ReadonlyArray<SyntaxDiagnostic>>. Diagnostics are structured values (stable code, severity, message, range) and accumulate over the whole source with recovery — an unexpected character, malformed number, invalid escape, unterminated string/list, or stray ) each produce their own coded diagnostic; nothing throws.
  • printSexp / printSexps — the canonical printer. A list of only atoms prints inline ((length-between 1 200)); otherwise the leading atoms stay on the head line and every remaining element gets its own indented line — the layout the design document writes manifests in. Printing is deterministic and parse(print(parse(x))) = parse(x) holds (property-tested); compare trees with sexpEquals, which ignores ranges.
  • tokenize(source) — the underlying lexer (tokens + lexical diagnostics), exposed for the language layer.

The grammar (closed, LLM-oriented)

  • Symbols: ASCII letters, digits, and -+*/<>=!?._ (length-between, >=, task.project.client).
  • Numbers: -?digits(.digits)?([eE][+-]?digits)?, must be finite; a digit-leading lexeme that fails this is syntax.invalid-number.
  • Booleans: true / false.
  • Strings: double-quoted with the closed escape set \" \\ \n \t \r.
  • ; starts a line comment; comments and whitespace are trivia.
  • Anything else is syntax.unexpected-character — the vocabulary is closed by design so LLM drift is a compile error, not a silent pass-through.

How it's organized

  • domain/modelSourcePos, SourceRange, LineIndex (offset→line/column), SyntaxDiagnostic (+ the stable syntax.* codes), Token, Sexp (+ sexpEquals, sexpRange).
  • domain/usecasetokenize (plgg-parser combinators with the user-state slot accumulating diagnostics), parseSexps (token reader with recovery), printSexp/printSexps (the canonical printer).

Conventions

  • as / any / ts-ignore are prohibited (see root CLAUDE.md).
  • Runtime dependencies are plgg and plgg-parser only — zero third-party dependencies.
  • After editing a file:-linked dependency's source, rebuild its dist or this package won't see new exports.