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

tree-sitter-llvm

v1.1.0

Published

Tree sitter parser for LLVM

Readme

Tree-sitter LLVM

A Tree-sitter grammar for LLVM IR assembly (.ll). This parser aims to closely follow LLVM's textual IR as parsed by LLParser, including modules, functions, types, instructions, attributes, metadata, and more.

Highlights and captures are provided in queries/highlights.scm.

Installation

  • Node.js

    • npm install tree-sitter-llvm
    • Usage:
      • const Parser = require('tree-sitter');
      • const llvm = require('tree-sitter-llvm');
      • const parser = new Parser();
      • parser.setLanguage(llvm);
      • const tree = parser.parse('%x = alloca i32');
  • Rust

    • Cargo.toml:
      • tree-sitter-llvm = "1.1.0"
    • Usage:
      • let mut parser = tree_sitter::Parser::new();
      • let language = tree_sitter_llvm::LANGUAGE;
      • parser.set_language(&language.into()).unwrap();
  • Python (tree-sitter >= 0.25)

    • pip install tree-sitter-llvm
    • Usage:
      • from tree_sitter import Language, Parser
      • import tree_sitter_llvm
      • parser = Parser()
      • parser.set_language(Language(tree_sitter_llvm.language()))
  • C

    • Include bindings/c/tree-sitter-llvm.h and link the generated parser in src/.
    • The language symbol is: const TSLanguage *tree_sitter_llvm(void);
  • Go

    • The binding is in bindings/go. Example with go-tree-sitter:
      • import (
        • "github.com/tree-sitter/go-tree-sitter"
        • llvm "path/to/this/repo/bindings/go"
        • )
      • parser := sitter.NewParser()
      • parser.SetLanguage(sitter.NewLanguage(llvm.Language()))
  • Swift (SwiftPM)

    • Add this repository as a dependency and use TreeSitterLlvm target.
    • Example:
      • import SwiftTreeSitter
      • import TreeSitterLlvm
      • let parser = Parser()
      • let language = Language(language: tree_sitter_llvm())
      • try parser.setLanguage(language)

Status and scope

  • Language name: llvm (as used by grammar.js)
  • Targets LLVM IR textual format (.ll). MIR is out of scope.
  • Grammar rules are modeled after LLVM's LLParser constructs (target definitions, declarations/definitions, instructions incl. alloca, getelementptr, phi, cmpxchg, atomicrmw, br; comdat; metadata; summaries; attributes; etc.).

Queries

  • queries/highlights.scm contains basic highlighting captures for common editors that consume Tree-sitter queries.

Development

  • Prerequisites: Node.js, npm, and tree-sitter-cli (npx tree-sitter works via devDependencies)
  • Generate/rebuild parser C sources:
    • npx tree-sitter generate
  • Run grammar tests (corpus under test/corpus):
    • npx tree-sitter test
  • Rust tests (ensures the language loads):
    • cargo test
  • Python tests:
    • pip install -e .[core]
    • pytest bindings/python/tests
  • Swift tests:
    • swift test

Example

  • See example/ and test/corpus for sample LLVM IR snippets and expected parses.

Contributing

  • Issues and PRs are welcome. Please run tree-sitter tests and format code before submitting.

License

  • MIT (see LICENSE)

Acknowledgements

  • Based on LLVM's existing bindings and textual IR structure: https://github.com/llvm/llvm-project/blob/main/llvm/utils/