I wrote a Lisp reader for C a long time ago: https://github.com/schani/lispreader
An interesting problem that came up was freeing deeply nested conses without overflowing the stack. I got a bug report about that from a user. They must have generated the structure in memory, because if they were reading it in, the reader would probably also have overflown the stack. In any case, the simple solution was to rotate the structure to be freed so that it can be freed without stack overflow or using an additional queue or stack:
https://github.com/schani/lispreader/blob/master/lispreader....