Skip to content

feat: C interop support (import c"...", c. prefix) #8

Description

@SchoolyB

Summary

Grayscale supports C interop (STANDARD.md §8.6) — importing C headers and calling C functions. The LSP has no awareness of this feature.

Example

import c"stdio.h"
import c"stdlib.h", c"string.h"

do main() {
    c.puts("hello from C")
    c.printf("value: %d\n", 42)
    mut home string = c_string(c.getenv("HOME"))
}

Key Details

  • import c"header.h" — system header (angle-bracket include)
  • import c"./mylib.h" — local header (quoted include)
  • All C functions accessed via c. prefix
  • Module name c is reserved for C interop

Scope

  • Recognize import c"..." syntax (no false diagnostics)
  • Recognize c. prefix as valid module access
  • Add hover docs explaining C interop basics

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