# benjamn/ast-types

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/benjamn-ast-types).**

1,172 stars · 197 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/benjamn/ast-types
- awesome-repositories: https://awesome-repositories.com/repository/benjamn-ast-types.md

## Description

This project is a framework for building, manipulating, and analyzing abstract syntax trees. It provides a toolkit for defining, traversing, and validating syntax trees that are compatible with the Mozilla Parser API, serving as a foundation for static code inspection and automated transformation tasks.

The library distinguishes itself through a declarative type system that enforces structural integrity across node hierarchies. By wrapping raw syntax nodes in context-aware objects, it enables developers to track parent relationships and ancestor chains without modifying the underlying tree structure. This system supports the registration of custom syntax types, allowing for the extension of standard hierarchies to accommodate non-standard language features.

The toolkit includes comprehensive utilities for navigating complex structures using visitor patterns, which facilitate both inspection and modification of code. It also provides integrated scope analysis to resolve variable bindings and lookup depths, alongside schema-driven validation to ensure that all nodes conform to predefined specifications.

## Tags

### Programming Languages & Runtimes

- [AST Manipulation Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/ast-manipulation-libraries.md) — Provides a toolkit for defining, traversing, and validating Mozilla Parser API compatible syntax trees.
- [AST Variable Scope Analysis](https://awesome-repositories.com/f/programming-languages-runtimes/ast-variable-scope-analysis.md) — Implements scope analysis to resolve variable bindings and lookup depths by identifying declarations within code blocks. ([source](https://github.com/benjamn/ast-types#readme))
- [JavaScript Static Analyzers](https://awesome-repositories.com/f/programming-languages-runtimes/javascript-static-analyzers.md) — Provides tools for inspecting and analyzing JavaScript source code by navigating its underlying syntax tree structure.
- [Language Extensions](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/language-features/language-extensions.md) — Enables the definition of new syntax or language features by extending standard node hierarchies.

### Development Tools & Productivity

- [JavaScript AST Transformations](https://awesome-repositories.com/f/development-tools-productivity/ast-transformation-tools/standardized-ast-transformation/javascript-ast-transformations.md) — Automates code refactoring and transpilation tasks by traversing and modifying syntax tree nodes.

### Software Engineering & Architecture

- [AST Visitor Patterns](https://awesome-repositories.com/f/software-engineering-architecture/ast-visitor-patterns.md) — Navigates complex tree structures using visitor patterns to enable code inspection and modification.
- [Tree Traversal](https://awesome-repositories.com/f/software-engineering-architecture/abstract-syntax-tree-parsing/tree-traversal.md) — Supports syntax tree traversal using a visitor pattern to inspect, transform, or validate code structures. ([source](https://github.com/benjamn/ast-types#readme))
- [Code Analysis Tools](https://awesome-repositories.com/f/software-engineering-architecture/code-analysis-tools.md) — Inspects variable scope and navigates nested code structures through visitor patterns and path-based node management.
- [Custom Node Definitions](https://awesome-repositories.com/f/software-engineering-architecture/custom-node-definitions.md) — Supports the registration of custom syntax types to extend standard hierarchies for non-standard language features.
- [Runtime Schema Validations](https://awesome-repositories.com/f/software-engineering-architecture/data-schema-validation/runtime-schema-validations.md) — Ensures data integrity during tree construction and transformation by validating node structures against predefined type definitions.
- [Structured Type Declarations](https://awesome-repositories.com/f/software-engineering-architecture/optional-value-types/default-value-insertions/model-property-defaults/structured-type-declarations.md) — Defines a formal schema for syntax nodes with support for property requirements and default values.
- [Syntax Tree Construction](https://awesome-repositories.com/f/software-engineering-architecture/trees/syntax-tree-construction.md) — Provides a framework for constructing and extending node hierarchies with declarative type definitions.
- [Syntax Tree Transformers](https://awesome-repositories.com/f/software-engineering-architecture/trees/syntax-tree-construction/syntax-tree-transformers.md) — Ensures generated or modified code structures conform to language specifications by enforcing type hierarchies and property requirements.
- [Node Type Validators](https://awesome-repositories.com/f/software-engineering-architecture/workflow-nodes/node-type-registries/node-type-validators.md) — Ensures syntax tree nodes conform to language specifications by enforcing required field types and default values. ([source](https://github.com/benjamn/ast-types/blob/master/src/def/es6.ts))

### Data & Databases

- [AST Context Analysis](https://awesome-repositories.com/f/data-databases/search-indexing-technologies/search-indexing/search-information-retrieval/code-context-search/ast-context-analysis.md) — Provides utilities for tracking ancestor chains and parent relationships within abstract syntax trees during traversal. ([source](https://github.com/benjamn/ast-types#readme))

### User Interface & Experience

- [Path-Based Node Selection](https://awesome-repositories.com/f/user-interface-experience/visual-node-editors/area-selection/path-based-node-selection.md) — Wraps raw syntax nodes in context-aware objects to track parent relationships without mutating the original tree.
