[doc,library] Document macro system extensions.

As indicated in the text, the bulk of this text is from the
D-expressions paper.