3 ms·
They are not that hairy. I did a recursive-descent one as a Common Lisp reader macro in less than 1k loc: https://github.com/vsedach/Vacietis/blob/master/compi
by sedachv 9y ago
They are not that hairy. I did a recursive-descent one as a Common Lisp reader macro in less than 1k loc:
https://github.com/vsedach/Vacietis/blob/master/compiler/reader.lisp https://github.com/vsedach/Vacietis/blob/master/compiler/rea...
C is ok in that you can handle everything (including typedefs) in a single pass with only one character lookahead. This includes the preprocessor. Common Lisp has concatenated streams (http://www.lispworks.com/documentation/HyperSpec/Body/t_concat.htm#concatenated-stream http://www.lispworks.com/documentation/HyperSpec/Body/t_conc...) which made handling the preprocessor really easy, but tcc (https://bellard.org/tcc/ https://bellard.org/tcc/) and I think pcc also do the preprocessing as part of the parser.