I've been studying up on reader macros and macros so I can understand them better. I have some questions about the former.

So a reader macro gets registered to the readtable using a single character, or two for dispatch read macros. This sounds a lot like LL(1) parsing to me, though it isn't necessarily since - I think - you can "unread" characters. Also, reader macros should have no side-effects except on the stream.

With that as background - which I may or may not have gotten right - I've got a few questions:

1. How many characters can you unread?

2. Even if you can unread as many as you want, does the setup effectively limit reading to certain subsets of context-free languages?

3. Would it be useful for reader macros to somehow keep "state" or "context"? (E.g. access to the call stack of reader macros.)

4. Would it be useful to have readers that operate on tokens rather than characters - that is, they run on the output of a lexer, or on the output of the regular reader macros?

By the way, "On Lisp" is a fantastic book, if a bit preachy. :D

Thanks!
Neil

Reply via email to