3 ms·
The Common Lisp specification has the entire reader algorithm laid out[1]. It fits on a single page, and it's really easy to understand. Note, however, that t
by aidenn0 6y ago
The Common Lisp specification has the entire reader algorithm laid out[1]. It fits on a single page, and it's really easy to understand.
Note, however, that there is heavy lifting done by the default read-table (the CL reader is table-based and is dynamically modifiable[2]), so you will only be able to read tokens if you implement what is on that page.
However, the most common characters are nearly trivial to implement: #\( #\" #\' as well as the most common dispatch characters for #\#
1: http://www.lispworks.com/documentation/HyperSpec/Body/02_b.htm http://www.lispworks.com/documentation/HyperSpec/Body/02_b.h...
2: Someone modified the lisp reader to be able to read in valid C89 code, and implemented a backend to compile that to common-lisp: https://github.com/vsedach/Vacietis https://github.com/vsedach/Vacietis