MLton/mlton — pull request #92 by MatthewFluet (2014-12-22 19:26:19+00:00)
Title: Move pervasive constructs from `ast` to `atoms`.

Most program constructs (e.g., `WordX` for word constants, `Label` for basic block labels) that are used in multiple ILs are defined in the `atoms` directory. However, some program constructs (e.g., `WordSize` for word constants, `Field` for record fields) that are used in multiple ILs are defined in the `ast` directory.

This pull request moves all of the pervasive program constructs that are defined in `ast` to `atoms`, so that `ast/sources.mlb` depends on `atoms/sources.mlb` and not the other way around.

There remains one more refactoring that we would be beneficial: `structure Atoms.Tyvar : TYVAR` is used in each of the AST IL, CoreML IL, and XML IL. This is in contrast to other identifiers, such as `structure Atoms.Var : ID`, which is not used in the AST IL (but is used in the remaining ILs); rather, `structure Ast.Var : AST_ID` is used in the AST IL and elaboration translates an `Ast.Var.t` to an `Atom.Var.t`. The distinction between `Ast.Var.t` and `Atoms.Var.t` is that the former carries position information and the equality corresponds to equality of the symbol, while the later carries no position information and equality corresponds to identity of the identifier (and all distinct bound variables correspond to distinct `Atoms.Var.t`s). We should make the same distinction between source-program type variables (i.e., a new `structure Ast.Tyvar : AST_ID`) and IL type variables (i.e., a revised `structure Atoms.Tyvar : ID`); again, the former would carry position information, while the latter would not. Unfortunately, the treatment of source-program type variables in the elaborator is somewhat ad hoc and it will be a more serious undertaking to distinguish the two kinds of type variables.