Skip to content

Add Zig parser support (.zig) #140

@josephismikhail

Description

@josephismikhail

Problem

Ix does not currently parse .zig files. Zig source files are treated as unrecognized and excluded from analysis, meaning systems-level logic, memory management patterns, and build configurations written in Zig are invisible to the system.

Proposed solution

Add a Zig parser that can identify and extract:

  • Function definitions (e.g. fn main() void {})
  • Struct, union, and enum definitions
  • Variable and constant declarations (var, const)
  • Import statements (e.g. @import("std"))
  • Comptime expressions and comptime blocks
  • Error handling patterns (e.g. try, catch, error unions)
  • Build system definitions (build.zig)

Support the following file patterns: *.zig

Why it matters

Zig is an emerging systems programming language gaining traction as a modern alternative to C, particularly for performance-critical and low-level code. It also serves as a cross-compilation toolchain used beyond Zig projects themselves. Without parsing Zig, Ix cannot reason about systems-level code or build logic in codebases that have adopted it.

Merge requirements

Before this can be merged to main, the following must pass:

  • Tested on 3 repos
  • No regressions on existing parsers (ix map on a known TS/JS repo, verify counts unchanged)
  • Unit + smoke tests pass (npm test in ix-cli)
  • Function definitions (fn) ingested as entities
  • Struct, union, and enum definitions ingested
  • var and const declarations ingested
  • @import statements resolved
  • comptime blocks ingested as entities
  • CONTAINS chains correctly: file → struct/enum → field/method
  • build.zig ingested and build-level declarations visible
  • ix text returns results with language: zig
  • ix contains returns members for a known Zig struct or enum

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions