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

@aster-cloud/aster-lang-ts

v0.1.5

Published

Aster CNL (Controlled Natural Language) TypeScript Compiler - Lexer, Parser, AST, Core IR, Type Checker

Readme

Aster Lang TypeScript Compiler

TypeScript implementation of the Aster CNL (Controlled Natural Language) compiler pipeline.

Overview

Aster is a pragmatic, type-safe language with human-readable controlled natural language syntax. This package provides the pure TypeScript compiler infrastructure:

  • Canonicalizer: Normalizes CNL source code
  • Lexer: Tokenizes source with multi-language lexicon support
  • Parser: Generates AST from token stream
  • Core IR: Intermediate representation
  • Type Checker: Static type analysis
  • LSP Server: Language Server Protocol implementation

Installation

pnpm install @aster-cloud/aster-lang-ts

Quick Start

import { canonicalize, lex, parse, lowerModule } from '@aster-cloud/aster-lang-ts';

// Compile pipeline
const source = `
Module greeting.

Rule greet given name, produce:
  Return Text.concat("Hello, ", name).
`;

const canonical = canonicalize(source);
const tokens = lex(canonical);
const ast = parse(tokens);
const core = lowerModule(ast);

Multi-Language Support

Aster supports writing policies in multiple natural languages:

import { canonicalize, lex, parse } from '@aster-cloud/aster-lang-ts';
import { ZH_CN } from '@aster-cloud/aster-lang-ts/lexicons/zh-CN';

const zhSource = `
模块 问候。

规则 问候 给定 姓名,产出:
  返回「你好,」 加 姓名。
`;

const tokens = lex(canonicalize(zhSource, ZH_CN), ZH_CN);
const ast = parse(tokens);

Supported languages:

  • English (en-US) - Default
  • Simplified Chinese (zh-CN)
  • German (de-DE)

Current CNL Style

  • Type inference is the default; examples avoid explicit type annotations.
  • Operator-call chaining is removed. Use standard calls or infix operators.
  • Statements end with periods, and block headers end with colons.

Documentation

  • docs/overview.md
  • docs/cnl-syntax.md
  • docs/type-inference.md
  • docs/operator-call.md
  • docs/examples.md
  • docs/contributing.md
  • Localized docs:
  • English (default): same list above.
  • 简体中文: docs/zh/overview.md, docs/zh/cnl-syntax.md, docs/zh/type-inference.md, docs/zh/operator-call.md, docs/zh/examples.md, docs/zh/contributing.md
  • Deutsch: docs/de/overview.md, docs/de/cnl-syntax.md, docs/de/type-inference.md, docs/de/operator-call.md, docs/de/examples.md, docs/de/contributing.md

Development

# Install dependencies
pnpm install

# Build
pnpm build

# Run tests
pnpm test:unit

# Start LSP server
pnpm lsp

# REPL
pnpm repl

Project Structure

src/
  ├── canonicalizer.ts    # Source normalization
  ├── lexer.ts            # Tokenization
  ├── parser.ts           # AST generation
  ├── ast.ts              # AST definitions
  ├── lower_to_core.ts    # Core IR lowering
  ├── core_ir.ts          # Core IR definitions
  ├── typecheck/          # Type checker
  ├── lsp/                # Language Server Protocol
  └── config/
      └── lexicons/       # Multi-language lexicons
          ├── en-US.ts
          ├── zh-CN.ts
          └── de-DE.ts

API Reference

Core Exports

| Export | Description | |--------|-------------| | canonicalize(source, lexicon?) | Normalize CNL source | | lex(source, lexicon?) | Tokenize source | | parse(tokens) | Parse to AST | | lowerModule(ast) | Convert AST to Core IR | | typecheck(module) | Type check module |

Lexicon Exports

import { EN_US } from '@aster-cloud/aster-lang-ts/lexicons/en-US';
import { ZH_CN } from '@aster-cloud/aster-lang-ts/lexicons/zh-CN';
import { DE_DE } from '@aster-cloud/aster-lang-ts/lexicons/de-DE';

License

MIT