How sxijyoti/polyglot-parser works
This is a C proof of concept that parses Python, JavaScript, and Ruby source into a shared symbol/dependency representation and exports unified JSON. The main workflow is CLI input → file/directory parsing → language adapters → IR and dependency graph → JSON output. The README also describes the graph as an input for Function Mesh and IntelliSense. Source excerpts establish the central orchestration and JavaScript extraction; some adapter dispatch details are not shown, so those links are marked unverified.
Main entry points: ir.c Symbol and dependency IR · parser.c Parse orchestration · adapters.c Language dispatch · mc_export.c JSON serialization
Components 13
Input and API
- CLI
src/main.c - Parse orchestration
src/parser.c
Language parsing
- Language dispatch
adapters/adapters.c - JavaScript extraction
adapters/js_adapter.c - Python extraction
adapters/python_adapter.c - Ruby extraction
adapters/ruby_adapter.c
Unified model
- Symbol and dependency IR
ir/ir.c - Dependency graph
graph/graph.c
JSON output
- JSON serialization
exporter/mc_export.c
Other components
- CLI user
- Tree-sitter
- Unified JSON
- IntelliSense / Function Mesh
Connections 18
- CLI user → CLI: invokes
README.md - CLI → Parse orchestration: requests parsing
src/main.c - Parse orchestration → Language dispatch: dispatches files
src/parser.c - Language dispatch → JavaScript extraction: selects adapter
- Language dispatch → Python extraction: selects adapter
- Language dispatch → Ruby extraction: selects adapter
- JavaScript extraction → Tree-sitter: queries syntax
adapters/js_adapter.c - JavaScript extraction → Symbol and dependency IR: adds symbols and dependencies
adapters/js_adapter.c - Python extraction → Symbol and dependency IR: adds parsed data
- Ruby extraction → Symbol and dependency IR: adds parsed data
- Parse orchestration → Dependency graph: builds graph
src/parser.c - Dependency graph → Symbol and dependency IR: reads dependencies and symbols
graph/graph.c - Parse orchestration → JSON serialization: requests serialization
src/parser.c - JSON serialization → Symbol and dependency IR: serializes symbols
exporter/mc_export.c - JSON serialization → Dependency graph: serializes edges
exporter/mc_export.c - JSON serialization → Unified JSON: produces
exporter/mc_export.c - CLI → Unified JSON: prints or writes
src/main.c - Unified JSON → IntelliSense / Function Mesh: consumed by
README.md