Files
mercury/compiler/make_hlds.m
Zoltan Somogyi 92438b2ec6 Make make_hlds.m a package.
compiler/make_hlds.m:
    This module used to both

    - include several submodules, and
    - define several types and predicates.

    For some years now, we have preferred to do these two kinds of things
    in separate modules, with package modules containing *only* include_module
    declarations, and other modules containing *no* include_module
    declarations. The reason is that submodules of a package automatically
    get the imports of their parent, which creates unwanted coupling
    between the submodule and its parent. This problem vanishes if
    the parent module contains no imports, but the only practical way
    to sustain that over time is for the parent to define nothing.

    This diff therefore moves the definitions of types and predicates
    out of make_hlds.m. It moves the types to a new submodule,
    make_hlds_types.m. Since the predicates it defined were only
    forwarding predicates, they can be deleted without replacement,
    provided that the predicates they forwarded to are in *public*
    submodules of make_hlds.m. This diff therefore arranges that.
    It does the same with a forwarding type.

compiler/make_hlds_types.m:
    A new submodule of make_hlds.m that contains the type definitions
    that used to be in make_hlds.m itself.

compiler/instance_method_clauses.m:
    A new submodule of make_hlds.m that contains the parts of add_class.m
    that generate the clauses that define predicates that implement
    instance methods. This part of add_class.m was completely separate
    from the rest of add_class.m (it wasn't even invoked from there),
    so putting it in its own module eliminates unnecessary coupling.

compiler/notes/compiler_design.html:
    Document the new modules.

compiler/add_class.m:
    Delete the code that has been moved to instance_method_clauses.m.

compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_mode.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pragma.m:
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_type.m:
compiler/check_typeclass.m:
compiler/goal_expr_to_goal.m:
compiler/make_hlds_passes.m:
compiler/make_hlds_warn.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_main.m:
compiler/qual_info.m:
compiler/state_var.m:
compiler/superhomogeneous.m:
    Conform to the changes above, mostly by adding explicit import_module
    declarations to replace a subset of the import_module declarations
    that these modules used to implicitly inherit from their parent.
2022-03-31 16:54:33 +11:00

62 lines
2.5 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et
%---------------------------------------------------------------------------%
% Copyright (C) 1993-2006, 2009-2011 The University of Melbourne.
% This file may only be copied under the terms of the GNU General
% Public License - see the file COPYING in the Mercury distribution.
%---------------------------------------------------------------------------%
%
% File: make_hlds.m.
% Main author: fjh.
%
% This package converts an augmented compilation unit
% into the high level data structure defined in hlds.m.
%
% The augmented compilation unit contains the parse trees of
%
% - the module being compiled,
% - the parse trees of the (compiler generated) interface files of the
% modules it imports, directly or indirectly, and possibly
% - the (also compiler generated) optimization files of those modules.
%
% All these parse trees contains lists of declarations and definitions
% of entities of various kinds. This package inserts those declarations
% and definitions into the HLDS after appropriate checks, e.g. for duplicates.
% It also converts Mercury clauses from the sort of concrete syntax tree
% constructed by the parser, to the abstract syntax tree used by every
% other part of the compiler. (For example, the parser represents the
% conjunction of three goals as `conj_expr(GoalA, conj_expr(GoalB, GoalC))',
% while the HLDS represents it as conj([GoalA, GoalB, GoalC]).)
% This transformation also converts clauses into superhomogenous form,
% and quantifies apart unrelated occurrences of the same variable name.
%
%---------------------------------------------------------------------------%
:- module hlds.make_hlds.
:- interface.
:- include_module instance_method_clauses.
:- include_module make_hlds_passes.
:- include_module make_hlds_types.
:- include_module qual_info.
:- implementation.
:- include_module add_class.
:- include_module add_clause.
:- include_module add_foreign_proc.
:- include_module add_mode.
:- include_module add_mutable_aux_preds.
:- include_module add_pragma.
:- include_module add_solver.
:- include_module add_type.
:- include_module field_access.
:- include_module goal_expr_to_goal.
:- include_module make_hlds_warn.
:- include_module state_var.
:- include_module superhomogeneous.
%---------------------------------------------------------------------------%
:- end_module hlds.make_hlds.
%---------------------------------------------------------------------------%