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-lux

v2.2.0

Published

Tree-sitter parser for the Lux programming language

Readme

tree-sitter-lux

Build Status semantic-release NPM Version MIT

tree-sitter-lux is a Tree-sitter grammar for the Lux language. It is based on this syntax document.

installation

npm install tree-sitter tree-sitter-lux

usage

A basic nodejs script might look like this:

const Parser = require('tree-sitter');
const Lux = require('tree-sitter-lux');

const parser = new Parser();
parser.setLanguage(Lux);

const sourceCode = '(+ 1 1)';
const tree = parser.parse(sourceCode);

console.log(tree.rootNode.toString());

This produces the following syntax tree

(lux
  (form
    (identifier)
    (natural)
    (natural)))

current features

Currently the grammar recognizes all the basic Lux literals comment, bit, natural, integer, revolution, fraction, text, identifier, tag, form, tuple and record.

planned features

Recognizing definitions, anonymous functions and modules

api

The node types in the abstract syntax tree generated by tree-sitter correspond to Lux syntax tokens. Additional meaning that is derived from those syntax tokens, e.g. that(def: x Int +1) is a definition, might be encoded using fields on the node.

The top level node type is always lux. Children of the lux node are of one of the following types:

comment

Recognizes comments, e.g. ## this is a comment.

bit

Recognizes bits, e.g. #0 and #1.

natural

Recognizes naturals, e.g. 123.

integer

Recognizes integers, e.g. +123 and -456.

revolution

Recognizes revolutions, e.g. .123.

fraction

Recognizes fractions, e.g. +123.456.

text

Recognizes text, e.g. "text".

identifier

Recognizes identifiers, e.g. identifier, prefix.identifier, or ..identifier.

tag

Recognizes tags, e.g. #tag.

form

Recognizes forms, e.g. (+ 1 2). This example produces the following syntax tree:

(lux
  (form
    (identifier)
    (natural)
    (natural)))

Children of form nodes can be of any of the top level types.

tuple

Recognizes tuples, e.g. [a +2 "c"]. This example produces the following syntax tree:

(lux
  (tuple
    (identifier)
    (integer)
    (text)))

Children of form nodes can be of any of the top level types.

record

Recognizes records, e.g. {#a b "c" 4}. This example produces the following syntax tree:

(lux
  (record
    (pair key: (tag) value: (identifier))
    (pair key: (text) value: (natural))))

Children of record nodes can be of type comment or pair.

pair

Recognizes pairs of syntax tokens, but only inside records, e.g. #a b inside {#a b}. This example produces the following syntax tree:

(lux (record (pair key: (tag) value: (identifier))))

Notice the fields for key and value inside pair node. Children of pair nodes can be of any of the top level types.

Don't assume that there are exactly two children inside a pair. There might be a comment between the key and value. However, you can assume that there are always exactly two non-comment nodes inside a pair. Otherwise there would be an error.

ERROR or MISSING

Anything that is not recognized as valid Lux syntax will be encoded by a node of type ERROR or MISSING.

changelog

All notable changes to this project will be documented in this changelog. The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.