ANTLR-Powered
Built on ANTLR v4, the industry-standard parser generator for reliable, battle-tested parsing.
Type-safe AST parsing for JavaScript with extensible architecture powered by ANTLR v4
import { parse } from '@sylphlab/ast-javascript';
const code = `
const greeting = "Hello, World!";
console.log(greeting);
`;
const ast = parse(code);
console.log(ast);The AST toolkit follows a layered architecture:
┌─────────────────────────────────────────┐
│ @sylphlab/ast-javascript │
│ (JavaScript-specific parser) │
└────────────────┬────────────────────────┘
│ depends on
▼
┌─────────────────────────────────────────┐
│ @sylphlab/ast-core │
│ (Generic AST interfaces & types) │
└─────────────────────────────────────────┘Source Code (String)
│
▼
ANTLR Lexer
(Tokenization)
│
▼
ANTLR Parser
(Parse Tree)
│
▼
Custom Visitor
(Transformation)
│
▼
Custom AST
(@sylphlab/ast-core types)Traditional AST tools are often:
AST Toolkit provides:
Production-ready AST parsing with a foundation for supporting any programming language.
| Component | Technology | Purpose |
|---|---|---|
| Language | TypeScript 5.8 | Type safety & modern JS |
| Parser | ANTLR v4 | Grammar-based parsing |
| Monorepo | pnpm workspaces | Dependency management |
| Build | Turborepo | Task orchestration |
| Bundler | tsup | Fast ESM/CJS builds |
| Testing | Vitest | Unit testing |
| Linting | ESLint 9 (flat config) | Code quality |
Ready to build AST parsers? Get started with our comprehensive guide: