docs/compilers/Design/Bound Node Design.md
This document discusses design principles for the bound nodes.
Generally speaking, that means that there is an isomorphism between the syntax and bound nodes, except when there is a mismatch between the shape of the syntax and semantics, in which case they model the shape of the semantics. When possible, we prefer the correspondence be as direct as possible. Here are two examples that illustrate this:
Default visit order for bound nodes should match order of evaluation, which usually matches lexical order.
A consumer of the bound nodes should not need to examine the syntax from which they were produced to understand the meaning of the bound nodes. All relevant semantic information that comes from the syntax should be summarized in the fields of the bound node. If a consumer of a bound node needs to refer to the syntax to affect the meaning of the code, that is a design smell.
In BoundNodes.xml, a Node should have a base that is BoundNode or a node type declared AbstractNode. Do not inherit a concrete node type from another concrete node type.