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

aviator-parser

v0.3.7

Published

TypeScript implementation of [AviatorScript](https://github.com/killme2008/aviatorscript).

Downloads

879

Readme

aviator-parser-ts

TypeScript implementation of AviatorScript.

Install

npm install aviator-parser

Usage

import { AviatorScript } from "aviator-parser";

const aviator = new AviatorScript();

// Expression
aviator.execute("1 + 2 * 3"); // 7

// Script
const result = aviator.execute(`
    let a = 10;
    let b = 20;
    
    fn max(x, y) {
        x > y ? x : y
    }
    
    max(a, b)
`); // 20

// With context
aviator.execute("a + b", { a: 1, b: 2 }); // 3

CLI

npm run cli          # REPL
npm run cli -- file.av
npm run cli -- -e "println(1 + 2)"

API

AviatorScript

import { AviatorScript } from "aviator-parser";

const aviator = new AviatorScript();

// Execute code
aviator.execute(code: string, context?: Record<string, any>): any

// Compile for reuse
const compiled = aviator.compile(code: string);
compiled.execute(context?: Record<string, any>): any

StaticAnalyzer

import { StaticAnalyzer, Diagnostic, DiagnosticSeverity, TypeEnv } from "aviator-parser";

const analyzer = new StaticAnalyzer(env?: TypeEnv);

// Analyze code and get diagnostics
const diagnostics: Diagnostic[] = analyzer.analyze(code: string);

// Diagnostic structure
interface Diagnostic {
    message: string;
    line: number;
    column?: number;
    severity: DiagnosticSeverity; // Error = 1, Warning = 2, Information = 3
    source: string;
}

// Type environment
const env: TypeEnv = {
    userId: AviatorType.Long,
    userName: AviatorType.String
};

Expression Parser (Pratt)

import { Pratt, Expr } from "aviator-parser";

// Parse expression
const ast: Expr = Pratt.parse("a + b * c");

// AST methods
ast.toString();  // "(a + (b * c))"
ast.rp();        // "(+ a (* b c))"

Script Parser

import { ScriptParser, Stmt } from "aviator-parser";

// Parse script to statements
const statements: Stmt[] = ScriptParser.parse(`
    let a = 1;
    let b = 2;
    a + b
`);

Interpreter

import { Interpreter } from "aviator-parser";

const interpreter = new Interpreter(context?: Record<string, any>);

// Evaluate expression
const result = interpreter.evaluate(expr: Expr): any

// Execute statements
const result = interpreter.executeStatements(statements: Stmt[]): any

// Execute block with new scope
const result = interpreter.executeBlock(statements: Stmt[], extraVariables?: Record<string, any>): any

// Define variable
interpreter.define(name: string, value: any): void

// Assign variable
interpreter.assign(name: string, value: any): void

Types

import { 
    AviatorType,           // enum: Long, Double, Boolean, String, Pattern, BigInt, Decimal, Nil, Void, Any, List, Map, Set
    DiagnosticSeverity,    // enum: Error = 1, Warning = 2, Information = 3
    Diagnostic,            // interface
    TypeEnv,               // interface: { [key: string]: AviatorType }
    Expr,                  // interface
    Stmt,                  // interface
    Token,                 // class
    TokenType,             // enum
    ParseError             // class extends Error
} from "aviator-parser";

Language

  • Types: numbers, strings, booleans, nil, regex, functions, collections
  • Operators: +, -, *, /, %, **, >, >=, <, <=, ==, !=, &&, ||, !, &, |, ^, ~, <<, >>, >>>
  • Statements: let, if/elsif/else, for, while, fn, return, break, continue
  • Features: closures, higher-order functions, string interpolation

Built-in Functions

  • System: print, println, p, sysdate, rand, now, type, range, tuple
  • String: string.length, string.contains, string.split, string.join, etc.
  • Math: math.abs, math.round, math.floor, math.ceil, math.sqrt, math.sin, etc.
  • Sequence: count, seq.list, seq.map, map, filter, reduce, sort, etc.

Development

npm install
npm test
npm run build

License

WTFPL