Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support C modules via ImportC #328

Open
vladimmi opened this issue Jul 12, 2023 · 1 comment
Open

Support C modules via ImportC #328

vladimmi opened this issue Jul 12, 2023 · 1 comment

Comments

@vladimmi
Copy link

At this point both DMD and LDC support compilation of C modules, automatically invoking external preprocessor for them if needed (DMD for some time, LDC since 1.33-beta2 version), dub also can treat C modules as part of project for building. Is it theoretically possible to have IDE support for this? I mean resolving C modules, having C functions in suggestions/goto, etc.

@Reavershark
Copy link

Starting off, code completion and other features use the dparse library very heavily (imported from 20+ modules). That library can't parse c files.

As I believe the D compiler frontend emits a D AST for C source code, I have some ideas:

  • Let the D compiler convert the C file to a D file, probably losing line:col positions of tokens.
  • Prefer using the dmd compiler as a library over dparse?
  • Impement lexing and parsing of C code into a D AST in libdparse, regarding C as a subset of D (not too hard).

Take them with a grain of salt, I'm very new to this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants