Files
whetstone_DSL/editor/src/DWARFBoundaryAnnotator.h
Bill 94f61dc97c Sprints 273-276: Polyglot FFI Glue, Symbol Index, and LSP Proxy (steps 1893-1912)
Sprint 273 — PolyglotFFIGlueGenerator (steps 1893-1897):
  ABIBoundaryExtractor, CHeaderEmitter, RustPythonBindingEmitter,
  GoCppBindingEmitter. Extracts exported symbols from toComponent provider
  and emits C ABI + language-specific bindings.

Sprint 274 — More Binding Pairs + DWARF (steps 1898-1902):
  CppJSBindingEmitter (N-API), RustGoBindingEmitter (#[no_mangle]),
  DWARFBoundaryAnnotator (DW_TAG_* + crossLangBoundary),
  FFIGlueDispatcher (routes by fromLang→toLang pair),
  MCP tool whetstone_generate_ffi_glue (#92).

Sprint 275 — Cross-Language Symbol Index (steps 1903-1907):
  SCIPEmitter (SCIP JSON, one doc/language, caller+provider roles),
  CrossLanguageSymbolTable (byLangName_ + byScip_ dual index),
  SymbolIndexUpdater (nodeKey diff, clear-and-rebuild),
  SymbolIndexOrchestrator (orchestrate + update),
  MCP tool whetstone_emit_symbol_index (#93).

Sprint 276 — LSP Proxy Core (steps 1908-1912):
  LSPProxyServer (JSON-RPC 2.0 dispatcher),
  LanguageServerRouter (routeByUri/routeByLanguageId),
  CrossLanguageBoundaryDetector (detect/detectWithUri/detectInLanguage),
  CrossLanguageDefinitionResolver (resolve/resolveFromUri → DefinitionLocation).
  End-to-end: Python call site goto-def resolves to Rust sort-core provider.

100/100 tests passing across all four sprints. Architecture gate clean.
LoRA sessions recorded for all sprints (~14k tokens captured).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 18:41:32 -07:00

44 lines
1.5 KiB
C++

#pragma once
#include "ABIBoundaryExtractor.h"
#include <nlohmann/json.hpp>
#include <string>
#include <vector>
namespace whetstone {
class DWARFBoundaryAnnotator {
public:
// Produce one JSON annotation object per ABIBoundaryNode.
static nlohmann::json annotate(const std::vector<ABIBoundaryNode>& nodes) {
nlohmann::json result = nlohmann::json::array();
for (const auto& node : nodes) {
nlohmann::json ann;
ann["astNodeId"] = makeAstNodeId(node);
ann["name"] = node.name;
ann["kind"] = node.kind;
ann["fromComponent"] = node.fromComponent;
ann["toComponent"] = node.toComponent;
ann["fromLanguage"] = node.fromLanguage;
ann["toLanguage"] = node.toLanguage;
ann["dwarfTag"] = dwarfTag(node.kind);
ann["crossLangBoundary"] = true;
result.push_back(std::move(ann));
}
return result;
}
private:
// Deterministic: "<fromComponent>:<toComponent>:<name>:<kind>"
static std::string makeAstNodeId(const ABIBoundaryNode& node) {
return node.fromComponent + ":" + node.toComponent + ":" + node.name + ":" + node.kind;
}
static std::string dwarfTag(const std::string& kind) {
if (kind == "function") return "DW_TAG_subprogram";
if (kind == "struct") return "DW_TAG_structure_type";
return "DW_TAG_variable";
}
};
} // namespace whetstone