3 ms·
So why haven't you implemented this as a compile-time thing? It should be fairly doable to parse and translate C headers to D code like that and then to just mi
by Doxin 9y ago
So why haven't you implemented this as a compile-time thing? It should be fairly doable to parse and translate C headers to D code like that and then to just mix it in. instead of needing a preprocessor you'd just get valid D code using something like
mixin(cHeader("headerfile.h"));
- atilaneves 9y agoBecause then I'd have to write a C parser that works at D compile-time. I'd much rather use libclang and know that what I get was parsed correctly. _Especially_ when I start doing C++.
- Doxin 9y agoI suggest you look at the pegged library. It does compile-time parser generation of parsers that work at compile time. I think the examples folder contains a C grammar. But then I suppose getting it working is better than getting it elegant.