Modify syntax tree for naming and typing

 - Introduce new trait Typed for an AST element that has a type
 - Introduce new trait Ref for an AST element that references another
   AST element (more specifically, a Decl).