Re:SmallerC – Small, Simple, Self-Compiling, Single Pass C C...
by delhanty on Sunday October 15, 2017 @09:40AM
(#15477058)
Thank you - that's informative.
>99% of the time spent writing a compiler will be elsewhere.
Out of interest, has the distribution of labor in that remaining 99% changed at all since you first started out?
For example, do things like LLVM change anything?
Re:SmallerC – Small, Simple, Self-Compiling, Single Pass C C...
by WalterBright on Sunday October 15, 2017 @04:42PM
(#15479193)
I re-used the Digital Mars C++ optimizer and back end for the dmd D compiler, so that would be like using LLVM for an optimizer and back end.
I still wind up spending nearly all my time on the D front end, and not the lexer/parser. The time spent on the lexer/parser is a rounding error.
Besides, build the lexer/parser by hand. The mystery of how to do them will evaporate, and you'll find you can apply that knowledge to all sorts of other tasks.
99% of the time spent writing a compiler will be elsewhere.
If you want a correct to the last drop C preprocessor, prepare to spend 6 months on that, minimum. Or just use Warp:
https://github.com/facebookarchive/warp
and then you can have fun just working on the compiler bit.