#ast #perl #syntax-tree

perl-ast

AST node definitions for Perl parsing, providing typed representations of Perl syntax constructs

7 releases

Uses new Rust 2024

new 0.14.0 May 12, 2026
0.13.3 May 3, 2026
0.13.0-rc1 Apr 30, 2026
0.12.2 Apr 8, 2026
0.12.1 Mar 31, 2026

#2453 in Parser implementations

Download history 21/week @ 2026-04-04 72/week @ 2026-04-11 64/week @ 2026-04-18 57/week @ 2026-04-25 20/week @ 2026-05-02

220 downloads per month
Used in 42 crates (10 directly)

MIT/Apache

240KB
5K SLoC

perl-ast

AST (Abstract Syntax Tree) node definitions for the Perl parser ecosystem.

Overview

perl-ast provides the typed node structures used to represent parsed Perl source code. It contains two AST modules:

  • ast -- The primary AST used by perl-parser. Defines Node (kind + SourceLocation) and the NodeKind enum with 50+ variants covering declarations, expressions, control flow, regex, OO constructs, and error recovery nodes. Includes S-expression serialization via to_sexp().
  • v2 -- Re-exported from the extracted perl-ast-v2 microcrate. This incremental-parsing surface is currently experimental/pre-stability; nodes carry a unique NodeId and use Range (line/column) positions instead of byte offsets. Adds NodeIdGenerator, MissingKind, DiagnosticId, and lightweight ErrorRef nodes.

Public API

Re-exports from lib.rs: Node, NodeKind, SourceLocation.

Workspace Role

Tier 1 leaf crate. Depended on by perl-parser-core, perl-tokenizer, perl-pragma, and perl-error.

Dependencies

  • perl-position-tracking -- span and position types (SourceLocation, Range, Position)
  • perl-token -- token definitions (Token, TokenKind) used in error recovery nodes

License

MIT OR Apache-2.0

AST compatibility contract

See the AST compatibility contract for the stability tiers and required coverage when adding or changing NodeKind variants.

Dependencies

~1–1.9MB
~39K SLoC