oxc_ast

Crates.iooxc_ast
lib.rsoxc_ast
version0.83.0
created_at2023-03-30 16:00:46.225362+00
updated_at2025-08-29 06:52:05.330045+00
descriptionA collection of JavaScript tools written in Rust.
homepagehttps://oxc.rs
repositoryhttps://github.com/oxc-project/oxc
max_upload_size
id825235
size2,018,616
Boshen (Boshen)

documentation

README

Oxc AST

Abstract Syntax Tree definitions for JavaScript, TypeScript, and JSX.

Overview

This crate provides comprehensive AST (Abstract Syntax Tree) node definitions that support the full spectrum of JavaScript and TypeScript syntax, including JSX. The AST closely follows ECMAScript specifications while providing ergonomic APIs for manipulation.

Key Features

  • Complete language support: JavaScript, TypeScript, JSX, and TSX
  • ECMAScript compliant: AST structure follows official specifications
  • Memory efficient: Designed to work with oxc_allocator for fast allocation
  • Visitor patterns: Integrates with oxc_ast_visit for traversal
  • Type-safe: Leverages Rust's type system for correctness

AST Design Principles

The AST design differs from estree in several important ways:

  • Explicit identifiers: Uses specific types like BindingIdentifier, IdentifierReference, and IdentifierName instead of generic Identifier
  • Precise assignment targets: AssignmentExpression.left uses AssignmentTarget instead of generic Pattern
  • Literal specialization: Replaces generic Literal with BooleanLiteral, NumericLiteral, StringLiteral, etc.
  • Evaluation order: Field order follows ECMAScript evaluation order for consistency

Architecture

The AST is designed for:

  • Parse: Efficient construction during parsing
  • Transform: Easy manipulation during transpilation
  • Visit: Systematic traversal for analysis
  • Codegen: Clean conversion back to source code

All AST nodes are allocated in an arena (oxc_allocator) for optimal performance.

Commit count: 11571

cargo fmt