Next: Collaborations
Up: Design Pattern: Translator
Previous: Structure
Participants
- Function (FUNCTION)
- declares an interface for function application. Its two type
parameters specify argument and result type respectively3.
- is used as the interface specification for both generic and specialized functions.
- Generic function (GEN_FUNC)
- corresponds to a denotational function definition.
- uses function package FUNCTIONS and run time type
information to choose and then delegate to a specialized function.
- Specialized function (e.g., PF_IF)
- corresponds to one pattern matching branch of a denotational function
definition.
- defines a local transformation for a source element
(e.g., TY_IF) to a corresponding target element (e.g.,
PP_IF).
- recursively transforms subcomponents of its argument as well.
- Function package (e.g., FUNCTIONS)
- conceptually bundles related specialized functions.
- declares a generic type for specialized functions to be refined by
concrete function packages.
- Concrete Function package (e.g., PP_FUNCTIONS)
- defines a mapping from source elements to their corresponding
specialized functions.
- creates prototypes of -- and then aggregates -- specialized functions.
- Client
- creates or uses a source structure (e.g., TOY_LANG).
- initializes or uses a function package (e.g., PP_FUNCTIONS).
- creates or uses a generic function (GEN_FUNC).
- applies a generic function to a source structure.
Next: Collaborations
Up: Design Pattern: Translator
Previous: Structure
Thomas Kuehne
1998-07-06