mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-18 07:15:19 +00:00
Estimated hours taken: 3.5 Branches: main Split the parse tree (currently defined in prog_data.m) into two separate modules. The reason for doing this is that while over 80% of the modules in the compiler import prog_data, very few of them actually require access to the types that define the parse tree (principally the item type). At the moment even small changes to these types can result in recompiles that rebuild almost all of the compiler. This change shifts the item type (and related types) into a new module, prog_item, that is only imported where these types are required (mostly at the frontend of the compiler). This should reduce the size of recompiles required when the parse tree is modified. This diff does not change any algorithms; it just shifts things around. compiler/prog_data.m: Move the item type and any related types that are not needed after the HLDS has been built to the new prog_item module. Fix bitrot in comments. Fix formatting and layout of comments. Use unexpected/2 in place of error/1 in a spot. compiler/prog_item.m: New file. This module contains any parts of the parse tree that are not needed by the rest of the compiler after the HLDS has been built. compiler/check_typeclass.m: s/list(instance_method)/instance_methods/ compiler/equiv_type.m: compiler/hlds_module.m: compiler/intermod.m: compiler/make.module_dep_file.m: compiler/make_hlds.m: compiler/mercury_compile.m: compiler/mercury_to_mercury.m: compiler/module_qual.m: compiler/modules.m: compiler/parse_tree.m: compiler/prog_io.m: compiler/prog_io_dcg.m: compiler/prog_io_goal.m: compiler/prog_io_pragma.m: compiler/prog_io_typeclass.m: compiler/prog_io_util.m: compiler/prog_out.m: compiler/prog_util.m: compiler/recompilation.check.m: compiler/recompilation.usage.m: compiler/recompilation.version.m: compiler/trans_opt.m: Conform to the above changes. compiler/notes/compiler_design.html: Mention the new module.
67 lines
2.2 KiB
Mathematica
67 lines
2.2 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%-----------------------------------------------------------------------------%
|
|
% Copyright (C) 2002-2005 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.
|
|
%-----------------------------------------------------------------------------%
|
|
%
|
|
% This package contains the parse tree data structure,
|
|
% and modules for parsing and for manipulating parse trees.
|
|
%
|
|
% It corresponds to the parts of "Phase 1: Parsing"
|
|
% in notes/compiler_design.html up to (but not including) make_hlds.m.
|
|
%
|
|
|
|
:- module parse_tree.
|
|
:- interface.
|
|
|
|
:- import_module libs.
|
|
:- import_module mdbcomp.
|
|
:- import_module recompilation.
|
|
|
|
% The parse tree data type itself.
|
|
% The parse tree is split in two. The parts defined in prog_item is
|
|
% only needed in the frontend of the compiler, the parts in prog_data
|
|
% are needed throughout.
|
|
:- include_module prog_item.
|
|
:- include_module prog_data.
|
|
|
|
% The parser.
|
|
:- include_module prog_io.
|
|
:- include_module prog_io_dcg.
|
|
:- include_module prog_io_goal.
|
|
:- include_module prog_io_pragma.
|
|
:- include_module prog_io_typeclass.
|
|
:- include_module prog_io_util.
|
|
|
|
% Pretty-printers.
|
|
:- include_module mercury_to_mercury.
|
|
:- include_module prog_out.
|
|
|
|
% Utility routines.
|
|
:- include_module prog_foreign.
|
|
:- include_module prog_mode.
|
|
:- include_module prog_mutable.
|
|
:- include_module prog_util.
|
|
:- include_module prog_type.
|
|
:- include_module prog_type_subst.
|
|
:- include_module error_util.
|
|
|
|
% Transformations that act on the parse tree,
|
|
% and stuff relating to the module system.
|
|
:- include_module equiv_type.
|
|
:- include_module modules.
|
|
:- include_module module_qual.
|
|
:- include_module source_file_map.
|
|
|
|
% (Note that intermod and trans_opt also contain routines that
|
|
% act on the parse tree, but those modules are considered part
|
|
% of the HLDS transformations package.)
|
|
% :- include_module intermod.
|
|
% :- include_module trans_opt.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
:- end_module parse_tree.
|
|
%-----------------------------------------------------------------------------%
|