$ show RomanYankovsky/DelphiAST
DelphiAST is a Delphi/FreePascal Abstract Syntax Tree (AST) builder that parses Object Pascal source code into a structured XML or binary representation. The architecture centers around a core library (DelphiAST.pas) comprising a lexer/parser extension (SimpleParserEx), AST node hierarchy (DelphiAST.Classes), XML/binary serializers (Writer, Serialize.Binary), string interning pool (StringPool), and project indexing utility (ProjectIndexer). Key entry points include TPasSyntaxTreeBuilder.Run() for parsing, TProjectIndexer for dependency resolution, and demo applications like ParserDemo (GUI AST visualizer) and ProjectIndexerResearch (console project analyzer). Data flows involve source code input → lexer → parser → AST construction → serialization/output or project analysis. External dependencies include FreePascal support submodules and Delphi/FPC RTL units like Generics.Collections.
The LLM identified 2 files worth highlighting for reuse:
Implements a highly efficient string interning pool using FNV-1a hashing and bucket-based storage to reduce memory usage for repeated strings. Self-contained with minimal dependencies (SysUtils, Classes, optional Generics.Collections), it can be extracted and used in any project requiring string deduplication without modification.
Defines the core AST node hierarchy (TSyntaxNode, TCompoundSyntaxNode, TValuedSyntaxNode, TCommentNode) with support for attributes, cloning, and parent/child relationships. Demonstrates a clean, reusable object-oriented model for syntax trees that can be adapted to other parsers with minimal changes, featuring encapsulated node management and polymorphic behavior.