4 ms·
Yes, consider the case of shecc. It requires just a handful of C code lines to interpret directives set in the C preprocessor. Unlike relying on existing tools
by jserv 3y ago
Yes, consider the case of shecc. It requires just a handful of C code lines to interpret directives set in the C preprocessor. Unlike relying on existing tools like cpp, as, or ld, shecc stands alone as a minimalist cross-compiler. This design could be particularly beneficial for students delving into the study of compiler construction. See https://github.com/sysprog21/shecc/blob/master/src/lexer.c#L245-L360 https://github.com/sysprog21/shecc/blob/master/src/lexer.c#L...
- lifthrasiir 3y agoI largely meant a standard-complaint implementation though, which shecc doesn't claim to be. ;-) In comparison I can easily see that this lexer is not suitable for preprocessor because C requires a superset of numeral tokens [1] during the preprocessing phase. [1] https://en.cppreference.com/w/c/language/translation_phases#Phase_3 https://en.cppreference.com/w/c/language/translation_phases#...