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

@artemis-lang/parser

v0.3.4

Published

The artemis language parser

Readme

@artemis-lang/parser

Syntax parser and Abstract Syntax Tree (AST) generator for the Artemis programming language.

Installation

npm install @artemis-lang/parser

Usage

import Parser from '@artemis-lang/parser';
import Lexer from '@artemis-lang/lexer';

const code = '(def x 42)';
const lexer = new Lexer(code);
const tokens = lexer.tokenize();

const parser = new Parser(tokens);
const ast = parser.parse();

console.log(ast);

Features

  • AST Generation: Converts tokens into Abstract Syntax Tree
  • Plugin Architecture: Extensible parser with plugin system
  • Error Handling: Comprehensive syntax error reporting
  • Node Types: Full support for all Artemis language constructs

Supported Language Constructs

Literals

  • Numbers (integers, binary, hexadecimal)
  • Strings
  • Booleans
  • Lists [1, 2, 3]
  • Maps {key: value}
  • Sets #[1, 2, 3]

Variables

  • Variable definition: (def name value)

Functions

  • Function definition: (fn name [params] (body))
  • Function calls: (functionName args)

Control Flow

  • If statements: (if (condition) (then) (else))
  • Match statements: (match value { pattern : action })

Loops

  • While loops: (while (condition) (body))
  • For loops: (for [var start end step] (body))

Operators

  • Binary operators: (+ a b), (* x y)
  • Unary operators: (! value), (~ bits)
  • Comparison: (> a b), (== x y)
  • Logical: (&& a b), (|| x y)

Special

  • Return statements: (return value)
  • JavaScript interop: (js $ code $)
  • Property access: (get object "property")

AST Node Types

The parser generates nodes with the following types:

  • Program: Root node
  • VariableDefinition: Variable declarations
  • FunctionDefinition: Function declarations
  • FunctionCall: Function invocations
  • If: If statements
  • While: While loops
  • For: For loops
  • Match: Pattern matching
  • Return: Return statements
  • BinaryExpression: Binary operations
  • UnaryExpression: Unary operations
  • Literal: Literal values (number, string, boolean)
  • List: Array literals
  • Map: Object literals
  • Set: Set literals

Example

import Parser from '@artemis-lang/parser';
import Lexer from '@artemis-lang/lexer';

const code = `
  (fn factorial [n] (
    (if ((== n 0)) (
      (return 1)
    )(
      (return (* n (factorial (- n 1))))
    ))
  ))
`;

const lexer = new Lexer(code);
const tokens = lexer.tokenize();

const parser = new Parser(tokens);
const ast = parser.parse();

console.log(JSON.stringify(ast, null, 2));

Version

Current version: 0.3.4

Changes in v0.3.4

  • Fixed parser crash with bounds checking in nextBy() method
  • Improved error messages
  • Enhanced null safety

Documentation

For complete language documentation, see the main README.

License

MIT

Links