Compiler#2
Merged
Merged
Conversation
Extract the .do-to-SQL translation logic (tokenizer, expression translator, command processor) into src/core/ with no DuckDB dependency. The DuckDB extension becomes a thin wrapper in src/extension/. A new dodoc CLI (src/cli/) compiles .do files to SQL, reading from stdin/file and writing to stdout/file. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- `make dodoc` builds the CLI with a single c++ invocation (no DuckDB) - `make dodoc-install` installs to /usr/local/bin - GitHub Actions workflow builds for macOS arm64/x86_64 and Linux x86_64/arm64, uploads binaries to GitHub Releases on dodoc-v* tags - README documents install and usage Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
MSVC build with static CRT (/MT), packaged as .zip. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR splits the DuckDB extension “glue” from the core .do-to-SQL translation logic, and introduces dodoc, a standalone compiler binary that can compile .do files to SQL without linking DuckDB.
Changes:
- Moved the extension interface into
src/extension/*and extracted a DuckDB-independent core intosrc/core/*. - Added
dodocCLI (Makefile + CMake target) plus a GitHub Actions workflow to build and publish release artifacts. - Added
src/include/*proxy headers to preserve include paths expected by DuckDB’s generated loader.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/include/string_utils.hpp | Proxy header forwarding to the new core location. |
| src/include/dodo_extension.hpp | Proxy header forwarding to the new extension header. |
| src/include/dodo_core.hpp | Proxy header forwarding to the new core header. |
| src/extension/dodo_extension.hpp | New extension-facing header that wraps dodo::DodoState for DuckDB. |
| src/extension/dodo_extension.cpp | New DuckDB extension entrypoint and parser/operator extension wiring. |
| src/core/string_utils.hpp | New DuckDB-independent string utilities + DodoException. |
| src/core/dodo_core.hpp | New core public API for parsing/compiling .do commands. |
| src/core/dodo_core.cpp | Refactored core implementation, plus extracted .do file processing helper. |
| src/cli/dodoc.cpp | New standalone CLI for compiling .do input to SQL. |
| README.md | Documentation for installing/using dodoc. |
| Makefile | Added dodoc build/install/clean targets. |
| CMakeLists.txt | Updated extension sources and added dodoc executable target. |
| .github/workflows/dodoc-release.yml | New release workflow for building and packaging dodoc binaries. |
Comments suppressed due to low confidence (3)
src/core/dodo_core.cpp:200
FileReadFunctioninterpolatesfilenamedirectly into single-quoted SQL string literals (e.g.,read_csv('...')) without escaping embedded'. Filenames containing a single quote will generate invalid SQL and can be used to inject SQL when compiling untrusted input. Escape single quotes infilename(replace'with'') before building the SQL literal.
src/core/dodo_core.cpp:2136- In the do-file lazy rewrite branch, you clear
state.cte_stepsand resetstep_counterbut you do not clearstate.cte_commands(and related undo/redo metadata). This can leavecte_steps/cte_commandsout of sync and break later history/live-view logic. Clearcte_commands(and consider clearingredo_stack/preserve fields) when resetting the chain here, matching the CLI’s reset logic.
src/core/dodo_core.cpp:206 ParseByOption(and several nearby helper functions) no longer have internal linkage (static) and are not declared in the public header. This unnecessarily exports symbols and increases the chance of name collisions at link time. Mark these helpersstaticagain (or declare them in the header if they’re meant to be public API).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+3
| // Proxy header — DuckDB's generated extension loader includes "dodo_extension.hpp" | ||
| // from src/include. Forward to the actual location. | ||
| #include "../extension/dodo_extension.hpp" |
Comment on lines
+1
to
+2
| // Proxy header — forward to actual location | ||
| #include "../core/dodo_core.hpp" |
Comment on lines
+1
to
+2
| // Proxy header — forward to actual location | ||
| #include "../core/string_utils.hpp" |
Comment on lines
+124
to
+128
| inline std::string QuoteIdent(const std::string &s) { | ||
| if (NeedsQuoting(s)) { | ||
| return "\"" + s + "\""; | ||
| } | ||
| return s; |
Comment on lines
+35
to
+38
| if (arg == "-h" || arg == "--help") { | ||
| print_usage(argv[0]); | ||
| std::exit(0); | ||
| } else if (arg == "-o" || arg == "--output") { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.