Skip to content

Commit 96ed12d

Browse files
committed
adding readmes
1 parent 524afe7 commit 96ed12d

File tree

2 files changed

+75
-2
lines changed

2 files changed

+75
-2
lines changed
Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1-
# Interpreter
1+
# Analyzer Module
22

3-
The Interpreter takes in the AST and
3+
## Overview
4+
The analyzer module performs static analysis and type checking on the HelixQL AST, ensuring queries are grammatically and semantically correct before code generation.
5+
6+
## Structure
7+
8+
### Core Components
9+
- **`mod.rs`** - Main analyzer entry point, orchestrates validation passes
10+
- **`types.rs`** - Type system definitions and type inference structures
11+
- **`diagnostic.rs`** - Diagnostic messages and error reporting
12+
- **`error_codes.rs`** - Error code definitions and messages
13+
- **`errors.rs`** - Error handling utilities
14+
- **`fix.rs`** - Auto-fix suggestions for common errors
15+
- **`pretty.rs`** - Pretty printing utilities for diagnostics
16+
- **`utils.rs`** - Helper functions for analysis
17+
18+
### Validation Methods (in `methods/`)
19+
- **`schema_methods.rs`** - Schema validation and field lookup building
20+
- **`query_validation.rs`** - Query structure and parameter validation
21+
- **`migration_validation.rs`** - Schema migration consistency checks
22+
- **`statement_validation.rs`** - Statement-level validation
23+
- **`traversal_validation.rs`** - Graph traversal operation validation
24+
- **`graph_step_validation.rs`** - Individual graph step validation
25+
- **`object_validation.rs`** - Object literal and remapping validation
26+
- **`infer_expr_type.rs`** - Expression type inference
27+
- **`exclude_validation.rs`** - Field exclusion validation
28+
29+
## Analysis Flow
30+
31+
1. **Input**: Parsed AST from the parser module
32+
2. **Schema Validation**: Verifies schema definitions are valid
33+
3. **Migration Validation**: Ensures migrations are consistent across versions
34+
4. **Query Validation**: Type-checks queries against schemas
35+
5. **Output**: Diagnostics (errors/warnings) and validated AST for code generation
36+
37+
38+
## Error Handling
39+
- Error codes provide consistent, searchable error identification
40+
- Diagnostics include source location for precise error reporting
41+
- Fix suggestions help users resolve common issues
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Generator Module
2+
3+
## Overview
4+
The generator module transforms the validated HelixQL AST into executable Rust code, creating type-safe graph database operations.
5+
6+
## Structure
7+
8+
### Core Components
9+
- **`mod.rs`** - Main generator entry point, defines output structure
10+
- **`utils.rs`** - Helper functions and code generation utilities
11+
12+
### Code Generation Methods (by domain)
13+
- **`schemas.rs`** - Generates Rust structs for nodes, edges, and vectors
14+
- **`queries.rs`** - Generates query functions with proper signatures
15+
- **`migrations.rs`** - Generates migration code for schema evolution
16+
- **`statements.rs`** - Generates statement execution code
17+
- **`traversal_steps.rs`** - Generates graph traversal operations
18+
- **`source_steps.rs`** - Generates source operations (add_n, add_e, n_from_id, n_from_type, etc.)
19+
- **`bool_ops.rs`** - Generates boolean expression evaluators
20+
- **`object_remappings.rs`** - Generates object transformation code
21+
- **`return_values.rs`** - Generates return value processing
22+
- **`tsdisplay.rs`** - TypeScript display utilities
23+
24+
## Generation Flow
25+
26+
1. **Input**: Validated AST from the analyzer module
27+
2. **Schema Generation**: Creates Rust structs for all schema types
28+
3. **Query Generation**: Transforms queries into Rust functions
29+
4. **Migration Generation**: Creates migration execution code
30+
5. **Output**: Complete Rust source code ready for compilation
31+
32+
## Code Generation Patterns
33+
- Uses Rust's `Display` trait for code generation
34+
- Maintains proper indentation and formatting
35+
- Generates idiomatic Rust code with appropriate error handling

0 commit comments

Comments
 (0)