| |
| Posted by 12345swordy in reply to 12345swordy | PermalinkReply |
|
12345swordy
Posted in reply to 12345swordy
| On Thursday, 22 April 2021 at 19:35:36 UTC, 12345swordy wrote:
> On Thursday, 22 April 2021 at 07:34:42 UTC, RazvanN wrote:
> https://forum.dlang.org/post/txdjmjkhradboqfmozlm@forum.dlang.org
On Tuesday, 6 October 2020 at 20:59:54 UTC, 12345swordy wrote:
> I remember reading a reddit comment saying that if d were to import c header files directly without any 3rd party libraries it would be a game changer. The question is: how difficult to implement a C AST parser for the dmd front end?
-Alex
As suggested by other participants to this thread, using libclang is the way to go. There really isn't any benefit in having a builtin C parser in dmd. Instead of working on this, I suggest to try to improve dpp as it is easy to install and use.
At UPB we have integrated a D driver in the linux kernel. Initially, we could not use dpp due to the complexity and oddity of the C code used in the kernel, so we translated the header files by hand: it was a nightmare. As Atila pointed out, there was an endless stream of dependencies. After the project was finished, we took on the responsibility to try to make dpp work with the linux kernel. We fixed tens of corner case and it looked like dpp could handle all of the cases, however we then stumbled upon a memory issue due to some bug in std.appender (used internally by dpp). Unfortunately, the student working on fixing dpp abandoned the project at that point, but we are very close to making dpp work with the linux kernel. If that works, I assure you that dpp will work in 99% of the cases.
Bottom line: it is better to improve dpp than to implement a C parser (when libclang already does that for you)
RazvanN
Anyways, I respectfully disagree, d should import c99 standard with no compiler extensions out of the box. Zig can do it, why not d?
-Alex
c99 standard compliant header files obviously ;p
-Alex
|