What if you were asked to add the description of a new feature to an
interpreter. What would you do?
There are a number of options:
- The feature is just a syntactic variation of something already in the
language (a new way of writing a conditional for example). This can be handled
in the parser.
- The feature is just syntactic sugar for some more complex way of
describing the same thing (like describing let in terms of
proc).
- The feature can evaluated at compile time and removed from the
abstract syntax tree (like a coercion).
- The new feature can best be described as a new primitive operation
(like adding another arithmetic function).
- The feature can be added to the evaluator as a special form.
- The feature doesn't add a special form, but it changes how something else
works: parameter passing, different ways to handle certain data types, etc.
In general, we cannot describe a new feature without coming to terms with
its syntax, its semantics, and how it handles data.