Generated: 2026-01-08 Commit: (Head) Branch: main
High-performance Rust-based transpiler converting R dplyr syntax to SQL. Supports multiple dialects (Postgres, MySQL, SQLite, DuckDB) via CLI and C++ extensions.
libdplyr/
├── libdplyr_c/ # C FFI bindings (crate)
├── extension/ # DuckDB extension (C++)
├── src/
│ ├── sql_generator/ # Dialect-specific logic
│ ├── parser/ # AST & Parser logic
│ └── cli/ # CLI infrastructure
└── tests/ # Integration tests
| Task | Location | Notes |
|---|---|---|
| Core Logic | src/lib.rs |
Entry point |
| Parsing | src/parser/parse.rs |
Recursive descent parser |
| SQL Gen | src/sql_generator/ |
Dialect logic |
| FFI | libdplyr_c/src/lib.rs |
C API surface |
| Extension | extension/src/dplyr.cpp |
DuckDB C++ hooks |
| Symbol | Type | Location | Role |
|---|---|---|---|
Transpiler |
Struct | src/lib.rs |
Main facade |
DplyrNode |
Enum | src/parser/ast.rs |
AST Root |
SqlGenerator |
Struct | src/sql_generator/mod.rs |
SQL Builder |
PostgreSqlDialect |
Struct | src/sql_generator/dialect.rs |
Dialect impl |
- TDD: Strict Red -> Green -> Refactor cycle.
- Traceability: Link code to requirements via
R#-AC#comments. - FFI Safety: Catch panics at C boundary (
libdplyr_c). - Pinning: Submodules/Dependencies pinned to exact commits.
- NO Unwraps: Use
Resultorexpectwith context. - NO Dynamic SQL: Use AST-based generation.
- NO Raw Pointers: Wrap in
ffi_safetyhelpers. - NO Console Log: Use
tracingordebug_logger.
- Korean Localization: Error messages support Korean.
- WASM Builds: Emscripten support baked into Makefile.
- Embedded Pipeline:
(| ... |)syntax in C++ extension.
# Build
cargo build --release
make extension # Build DuckDB extension
# Test
cargo test # All Rust tests
cargo test --test integration_tests
tests/run_smoke_tests.sh # Fast verification- Complexity:
src/parser/parse.rsandextension/src/dplyr.cppare hotspots. - Mutation: CTE/Subquery support for
mutateis limited. - Validation: Error positioning needs improvement.