Fix a string substitution bug -- key_nest_level propagate through lists.
Implement document class. Includes merge, feature key eval.

This patch does the following:
  - Implements a document class. A document is an environment and a dictionary.
    - It can merge other documents
    - It can run string substitution on itself.
    - It can evaluate feature keys in the context of itself.