[KG] Create Initial Library Code
Issue: Create Initial Library
Goal
Establish the foundational infrastructure for the gitlab-code-parser library that will serve as the base for all language-specific parsers. This issue focuses on creating the core parsing framework, rule loading system, and common utilities that will be shared across all language implementations (Ruby, Python, JavaScript/TypeScript, etc.).
Scope
This issue encompasses the essential building blocks needed before any language-specific parsing can begin:
Core Library Components:
- Parser Core Module: Base traits and structures for language parsers
- Rule Loading System: Infrastructure for loading and managing
ast-greprules from YAML files - Any AST Utilities: Common AST traversal and manipulation functions
- Configuration Management: System for parser configuration and options
Integration Points:
- ast-grep Integration: Core functionality for pattern matching and rule execution
File Structure
crates/parser-core/
├── src/
│ ├── lib.rs # Main library exports
│ ├── parser.rs # Core Parser trait and implementation
│ ├── rules/
│ │ ├── mod.rs # Rule loading and management
│ │ ├── loader.rs # YAML rule file loader
│ │ └── executor.rs # ast-grep rule execution
├── languages/ # Language-specific rule files
│ ├── ruby/
│ │ ├── definitions.yaml
│ │ ├── references.yaml
│ │ └── imports.yaml
│ └── python/
│ ├── definitions.yaml
│ ├── references.yaml
│ └── imports.yamlEdited by Michael Angelo Rivera