A
ReadMacro is a
LispMacro that is expanded at
ReadTime, so it can recognise specific characters (in constrast with regular
LispMacros, which are expanded at
CompileTime when the source has already been parsed). Pre-defined read macros are used extensively, and you can define your own to add whatever
SyntacticSugar you want to the language.
For example, the
QuoteOperator
'foo
seems like a built-in part of Lisp's syntax, but it's actually just a
ReadMacro that expands to
(quote foo)
There is a thorough treatment of all
LispMacros in the book
OnLisp (downloadable).
Hm, the macros of
TexLanguage could be could be considered
ReadMacros too. But there the whole macro expansion process is essentially done at
ReadTime, so... But wait: Macros are also expanded later when pages are formed and shipped out.
Macros in TeX are expanded by tokens. When reading from the file it makes the tokens according to the category code, and when expanding a macro, the token is fixed category code, even if you changed it later. And a macro is possible to expand into the command to modify itself or other macros. Also, inside of a \write whatsit node, can have macros which are expanded when shipping out the page.
CategoryCommonLisp CategoryTex