Docs / languages / c · Edit on GitHub

C

Tier 1 plugin for C source and headers. Focuses on include graph, function symbols, call resolution, and file::symbol qualified names.

Implementation

Plugin cratecrates/rgctl-lang-c (CPlugin)
Grammartree-sitter-c
Extensions.c, .h
Discoverrgctl discover . -l c -e build,cmake-build-debug,.rgctl --with-cfg
CFG / taintEnabled

Tree-sitter node kinds: function_definition, struct_specifier, enum_specifier, preprocessor_include.

What is extracted

Nodes

  • Functionqualified_name as file::symbol (e.g. review_repository::init)
  • Struct, Enum
  • Import#include preprocessor edges (.c files)

Edges

EdgeMeaning
CALLSFunction calls
ImportInclude / header dependencies

No OOP EXTENDS/INSTANTIATES — C uses struct composition at the type level only.

Verification

Fixturergctl-tests/ecommerce-c
Example corpusexample/linux (default discover)
Smoke scriptrgctl-tests/gql-verification-smoke/verify-extraction-gql-c.sh

GQL verification queries

Fixture probes

ProbeGQL
Call resolution (CALLS)MATCH (a)-[:CALLS]->(b) RETURN a,b LIMIT 10000
Include graph (Import from .c)MATCH (n:Import) WHERE n.file_path LIKE '*.c' RETURN n LIMIT 10
Qualified symbols (file::symbol)MATCH (n:Function) WHERE n.qualified_name LIKE "review_repository::*" RETURN n LIMIT 20

Example smoke (example/linux)

ProbeGQL
Import (scale)MATCH (n:Import) RETURN n LIMIT 10000
CALLS (scale)MATCH (a)-[:CALLS]->(b) RETURN a,b LIMIT 10000

Related