[m-rev.] Change compiler output to use `.' as module separator
Ralph Becket
rafe at cs.mu.OZ.AU
Thu Dec 19 11:56:30 AEDT 2002
Estimated hours taken: 3
Branches: main
Change the compiler and tools so that `.' and not `:' is now used as the
module separator in all output.
Infix `.' now has associativity yfx and priority 10.
NEWS:
Report the change.
compiler/code_gen.m:
compiler/error_util.m:
compiler/hlds_out.m:
compiler/prog_out.m:
compiler/prog_util.m:
compiler/rl_exprn.m:
compiler/rl_gen.m:
compiler/source_file_map.m:
compiler/unused_args.m:
library/io.m:
library/rtti_implementation.m:
library/type_desc.m:
runtime/mercury_debug.c:
runtime/mercury_deconstruct.c:
runtime/mercury_stack_trace.c:
Change `:' to `.' as module separator for output.
compiler/mercury_to_mercury.m:
compiler/prog_io_typeclass.m:
As above.
Fixed a bug where `.' was not being recognised as a module separator.
doc/reference_manual.texi:
Report the change.
library/term_io.m:
Ensure that infix `.' is written without surrounding spaces.
Index: NEWS
===================================================================
RCS file: /home/mercury1/repository/mercury/NEWS,v
retrieving revision 1.291
diff -u -r1.291 NEWS
--- NEWS 5 Dec 2002 03:52:27 -0000 1.291
+++ NEWS 19 Dec 2002 00:48:16 -0000
@@ -56,7 +56,8 @@
Changes to the Mercury compiler:
-* Nothing yet.
+* The Mercury compiler now uses `.' and not `:' as the module separator
+ in all output.
Portability improvements:
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.106
diff -u -r1.106 code_gen.m
--- compiler/code_gen.m 15 Nov 2002 04:50:19 -0000 1.106
+++ compiler/code_gen.m 3 Dec 2002 06:43:35 -0000
@@ -1352,7 +1352,7 @@
string__int_to_string(Arity, ArityStr),
proc_id_to_int(ProcId, ProcNum),
string__int_to_string(ProcNum, ProcNumStr),
- string__append_list([PredOrFuncString, " ", ModuleNameString, ":",
+ string__append_list([PredOrFuncString, " ", ModuleNameString, ".",
FullPredName, "/", ArityStr, "-", ProcNumStr], PushMsg).
:- pred code_gen__find_arg_type_ctor_name((type)::in, string::out) is det.
Index: compiler/error_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/error_util.m,v
retrieving revision 1.19
diff -u -r1.19 error_util.m
--- compiler/error_util.m 30 Jun 2002 17:06:13 -0000 1.19
+++ compiler/error_util.m 3 Dec 2002 06:43:56 -0000
@@ -445,7 +445,7 @@
PredOrFuncPart,
" `",
ModuleNameString,
- ":",
+ ".",
PredName,
"/",
ArityPart,
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.290
diff -u -r1.290 hlds_out.m
--- compiler/hlds_out.m 24 Oct 2002 04:36:41 -0000 1.290
+++ compiler/hlds_out.m 3 Dec 2002 06:44:45 -0000
@@ -2350,7 +2350,7 @@
hlds_out__write_qualified_functor(ModuleName, Functor, ArgVars, VarSet,
AppendVarnums) -->
mercury_output_bracketed_sym_name(ModuleName),
- io__write_string(":"),
+ io__write_string("."),
hlds_out__write_functor(Functor, ArgVars, VarSet, AppendVarnums,
next_to_graphic_token).
@@ -2362,7 +2362,7 @@
hlds_out__write_qualified_functor_with_term_args(ModuleName, Functor,
ArgTerms, VarSet, AppendVarNums) -->
mercury_output_bracketed_sym_name(ModuleName),
- io__write_string(":"),
+ io__write_string("."),
{ term__context_init(Context) },
mercury_output_term(term__functor(Functor, ArgTerms, Context), VarSet,
AppendVarNums, next_to_graphic_token).
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.220
diff -u -r1.220 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m 12 Aug 2002 02:37:08 -0000 1.220
+++ compiler/mercury_to_mercury.m 5 Dec 2002 04:17:01 -0000
@@ -1559,7 +1559,7 @@
{ prog_out__sym_name_to_string(Module, ModuleString) },
{ string__int_to_string(Arity, ArityString) },
add_strings(["<type_ctor_info for ",
- ModuleString, ":", Type, "/", ArityString, ">"]).
+ ModuleString, ".", Type, "/", ArityString, ">"]).
mercury_format_cons_id(base_typeclass_info_const(Module, Class, InstanceNum,
InstanceString), _) -->
{ prog_out__sym_name_to_string(Module, ModuleString) },
@@ -2163,12 +2163,15 @@
varset__lookup_name(VarSet, Var, String).
mercury_type_to_string(VarSet, term__functor(Functor, Args, _)) = String :-
(
- Functor = term__atom(":"),
+ Functor = term__atom(FunctorName),
+ ( FunctorName = "."
+ ; FunctorName = ":"
+ ),
Args = [Arg1, Arg2]
->
String1 = mercury_type_to_string(VarSet, Arg1),
String2 = mercury_type_to_string(VarSet, Arg2),
- string__append_list([String1, ":", String2], String)
+ string__append_list([String1, ".", String2], String)
;
(
Functor = term__atom(String0)
@@ -2613,7 +2616,7 @@
{ Name = qualified(ModuleName, PredName) },
mercury_output_bracketed_sym_name(ModuleName,
next_to_graphic_token),
- io__write_string(":"),
+ io__write_string("."),
{ term__context_init(Context0) },
mercury_output_term(term__functor(term__atom(PredName),
Term, Context0), VarSet, no, next_to_graphic_token)
@@ -3354,10 +3357,10 @@
{ mercury_infix_op(FunctorName) }
->
add_string("("),
- ( { FunctorName = ":" } ->
+ ( { FunctorName = ":" ; FunctorName = "." } ->
mercury_format_term(Arg1, VarSet, AppendVarnums,
next_to_graphic_token),
- add_string(":"),
+ add_string("."),
mercury_format_term(Arg2, VarSet, AppendVarnums,
next_to_graphic_token)
;
@@ -3567,7 +3570,7 @@
add_string("("),
mercury_format_bracketed_sym_name(ModuleName,
next_to_graphic_token),
- add_string(":"),
+ add_string("."),
mercury_format_bracketed_atom(Name2, next_to_graphic_token),
add_string(")")
;
@@ -3589,7 +3592,7 @@
{ Name = qualified(ModuleName, PredName) },
mercury_format_bracketed_sym_name(ModuleName,
next_to_graphic_token),
- add_string(":"),
+ add_string("."),
mercury_format_quoted_atom(PredName, next_to_graphic_token)
;
{ Name = unqualified(PredName) },
Index: compiler/prog_io_typeclass.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_typeclass.m,v
retrieving revision 1.26
diff -u -r1.26 prog_io_typeclass.m
--- compiler/prog_io_typeclass.m 25 Sep 2002 06:49:13 -0000 1.26
+++ compiler/prog_io_typeclass.m 3 Dec 2002 06:54:50 -0000
@@ -489,7 +489,9 @@
Type = term__functor(term__atom(Functor),
Args, _),
(
- Functor = ":"
+ ( Functor = ":"
+ ; Functor = "."
+ )
->
Args = [_Module, Type1],
% Is the top level functor an
Index: compiler/prog_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_out.m,v
retrieving revision 1.47
diff -u -r1.47 prog_out.m
--- compiler/prog_out.m 25 Mar 2002 19:27:29 -0000 1.47
+++ compiler/prog_out.m 3 Dec 2002 06:55:18 -0000
@@ -50,16 +50,14 @@
% sym_name_to_string(SymName, String):
% convert a symbol name to a string,
% with module qualifiers separated by
- % the standard Mercury module qualifier operator
- % (currently ":", but may eventually change to ".")
+ % the standard Mercury module qualifier operator.
:- pred prog_out__sym_name_to_string(sym_name, string).
:- mode prog_out__sym_name_to_string(in, out) is det.
% sym_name_to_string(SymName, String):
% convert a symbol name and arity to a "<Name>/<Arity>" string,
% with module qualifiers separated by
- % the standard Mercury module qualifier operator
- % (currently ":", but may eventually change to ".")
+ % the standard Mercury module qualifier operator.
:- pred prog_out__sym_name_and_arity_to_string(sym_name_and_arity, string).
:- mode prog_out__sym_name_and_arity_to_string(in, out) is det.
@@ -162,7 +160,7 @@
prog_out__write_sym_name(qualified(ModuleSpec,Name)) -->
prog_out__write_module_spec(ModuleSpec),
- io__write_string(":"),
+ io__write_string("."),
term_io__write_escaped_string(Name).
prog_out__write_sym_name(unqualified(Name)) -->
term_io__write_escaped_string(Name).
@@ -178,7 +176,7 @@
io__write_string("'").
prog_out__sym_name_to_string(SymName, String) :-
- prog_out__sym_name_to_string(SymName, ":", String).
+ prog_out__sym_name_to_string(SymName, ".", String).
prog_out__sym_name_to_string(SymName, Separator, String) :-
prog_out__sym_name_to_string_2(SymName, Separator, Parts, []),
Index: compiler/prog_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_util.m,v
retrieving revision 1.57
diff -u -r1.57 prog_util.m
--- compiler/prog_util.m 9 Jul 2002 01:29:42 -0000 1.57
+++ compiler/prog_util.m 3 Dec 2002 06:55:57 -0000
@@ -231,7 +231,7 @@
construct_qualified_term(qualified(Module, Name), Args, Context, Term) :-
construct_qualified_term(Module, [], Context, ModuleTerm),
UnqualifiedTerm = term__functor(term__atom(Name), Args, Context),
- Term = term__functor(term__atom(":"),
+ Term = term__functor(term__atom("."),
[ModuleTerm, UnqualifiedTerm], Context).
construct_qualified_term(unqualified(Name), Args, Context, Term) :-
Term = term__functor(term__atom(Name), Args, Context).
Index: compiler/rl_exprn.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_exprn.m,v
retrieving revision 1.25
diff -u -r1.25 rl_exprn.m
--- compiler/rl_exprn.m 28 Mar 2002 03:43:35 -0000 1.25
+++ compiler/rl_exprn.m 17 Dec 2002 02:21:57 -0000
@@ -1567,7 +1567,7 @@
;
{ prog_out__sym_name_to_string(PredModule0, PredModule) },
{ pred_info_arity(PredInfo, Arity) },
- { string__format("Sorry, not implemented in Aditi: %s:%s/%i",
+ { string__format("Sorry, not implemented in Aditi: %s.%s/%i",
[s(PredModule), s(PredName), i(Arity)], Msg) },
{ error(Msg) }
).
Index: compiler/rl_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_gen.m,v
retrieving revision 1.7
diff -u -r1.7 rl_gen.m
--- compiler/rl_gen.m 28 Mar 2002 03:43:35 -0000 1.7
+++ compiler/rl_gen.m 17 Dec 2002 02:22:05 -0000
@@ -1513,7 +1513,7 @@
{ prog_out__sym_name_to_string(Module0, Module) },
{ pred_info_name(PredInfo, Name) },
{ pred_info_arity(PredInfo, Arity) },
- rl_info_write_message("Generating call to %s:%s/%i\n",
+ rl_info_write_message("Generating call to %s.%s/%i\n",
[s(Module), s(Name), i(Arity)]),
(
{ hlds_pred__is_aditi_aggregate(ModuleInfo, PredId) },
Index: compiler/source_file_map.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/source_file_map.m,v
retrieving revision 1.4
diff -u -r1.4 source_file_map.m
--- compiler/source_file_map.m 16 Jun 2002 09:14:34 -0000 1.4
+++ compiler/source_file_map.m 5 Dec 2002 04:21:03 -0000
@@ -100,7 +100,7 @@
(
{ ModuleCharsResult = ok(RevModuleChars) },
{ string__from_rev_char_list(RevModuleChars, ModuleStr) },
- { string_to_sym_name(ModuleStr, ":", ModuleName) },
+ { string_to_sym_name(ModuleStr, ".", ModuleName) },
read_until_char('\n', [], FileNameCharsResult),
(
{ FileNameCharsResult = ok(FileNameChars) },
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.77
diff -u -r1.77 unused_args.m
--- compiler/unused_args.m 28 Mar 2002 03:43:47 -0000 1.77
+++ compiler/unused_args.m 3 Dec 2002 07:12:33 -0000
@@ -950,7 +950,9 @@
string__int_to_string(TypeArity, TypeAr),
prog_out__sym_name_to_string(TypeModule,
TypeModuleString0),
- string__replace_all(TypeModuleString0, ":", "__",
+ string__replace_all(TypeModuleString0, ".", "__",
+ TypeModuleString1),
+ string__replace_all(TypeModuleString1, ":", "__",
TypeModuleString),
string__append_list([Name0, "_", TypeModuleString,
"__", TypeName, "_", TypeAr], Name1)
@@ -1580,7 +1582,7 @@
io__write_string(" `"),
{ pred_info_module(PredInfo, Module) },
prog_out__write_sym_name(Module),
- io__write_string(":"),
+ io__write_string("."),
{ pred_info_name(PredInfo, Name) },
io__write_string(Name),
io__write_string("/"),
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.263
diff -u -r1.263 reference_manual.texi
--- doc/reference_manual.texi 7 Nov 2002 06:14:09 -0000 1.263
+++ doc/reference_manual.texi 3 Dec 2002 08:12:02 -0000
@@ -415,6 +415,7 @@
Operator Specifier Priority
+. yfx 10
@@ xfx 50
^ xfy 99
^ fx 100
@@ -439,7 +440,6 @@
\/ yfx 500
aditi_bottom_up fx 500
aditi_top_down fx 500
-. xfy 600
: yfx 600
:= xfx 650
=^ xfx 650
@@ -3837,6 +3837,8 @@
@node Modules
@chapter Modules
+ at c XXX At some point in the future, change the rest of the documentation
+ at c to use `.' as the module separator rather than `__'.
@menu
* The module system::
@@ -3899,18 +3901,19 @@
The names of predicates, functions, constructors, constructor fields,
types, modes, insts, type classes,
-and (sub-)modules can be explicitly module qualified using the @samp{:}
-operator, e.g.@: @samp{module:name} or @samp{module:submodule:name}.
+and (sub-)modules can be explicitly module qualified using the @samp{.}
+operator, e.g.@: @samp{module.name} or @samp{module.submodule.name}.
This is useful both for readability and for resolving name conflicts.
Uses of entities imported using @code{use_module} declarations
@emph{must} be explicitly module qualified.
-Currently we also support @samp{__} as an alternative module qualifier,
-so you can write @code{module__name} instead of @code{module:name}.
-We are considering changing the module qualifier from @samp{:}
-to @samp{.} in a future version, so that we can use @samp{:} as
-a type qualifier instead. Hence for the time being we recommend
-that you use @samp{__} rather than @samp{:} as module qualifier.
+Currently we also support @samp{__} and @samp{:} as alternative
+module qualifiers,
+so you can write @code{module__name} or @code{module:name} instead
+of @code{module.name}.
+We intend to change the use of @samp{:} to being a type
+qualifier instead in a future version, its use as a module qualifier
+is therefore deprecated.
Certain optimizations require information or source code for predicates
defined in other modules to be as effective as possible. At the moment,
@@ -4057,7 +4060,7 @@
Each of the named sub-modules in an @samp{:- include_module} declaration
must be defined in a separate source file.
The mapping between module names and source file names is
-implementation-defined. (For a module named @samp{foo:bar:baz},
+implementation-defined. (For a module named @samp{foo.bar.baz},
The University of Melbourne Mercury implementation requires the source
to be located in a file named @file{foo.bar.baz.m}, @file{bar.baz.m},
or @file{baz.m}.)
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.282
diff -u -r1.282 io.m
--- library/io.m 4 Dec 2002 09:39:37 -0000 1.282
+++ library/io.m 17 Dec 2002 02:22:21 -0000
@@ -2894,7 +2894,7 @@
( { ModuleName = "builtin" } ->
io__format("%s/%d", [s(Name), i(Arity)])
;
- io__format("%s:%s/%d", [s(ModuleName), s(Name), i(Arity)])
+ io__format("%s.%s/%d", [s(ModuleName), s(Name), i(Arity)])
).
:- pred io__write_c_pointer(c_pointer, io__state, io__state).
Index: library/rtti_implementation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/rtti_implementation.m,v
retrieving revision 1.35
diff -u -r1.35 rtti_implementation.m
--- library/rtti_implementation.m 3 Dec 2002 11:25:36 -0000 1.35
+++ library/rtti_implementation.m 17 Dec 2002 01:48:36 -0000
@@ -970,9 +970,9 @@
expand_type_name(TypeCtorInfo, Wrap) = Name :-
( Wrap = yes ->
- FmtStr = "<<%s:%s/%d>>"
+ FmtStr = "<<%s.%s/%d>>"
;
- FmtStr = "%s:%s/%d"
+ FmtStr = "%s.%s/%d"
),
Name = string__format(FmtStr, [s(TypeCtorInfo ^ type_ctor_module_name),
s(TypeCtorInfo ^ type_ctor_name),
Index: library/term_io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/term_io.m,v
retrieving revision 1.65
diff -u -r1.65 term_io.m
--- library/term_io.m 30 May 2002 04:39:48 -0000 1.65
+++ library/term_io.m 5 Dec 2002 05:22:10 -0000
@@ -346,6 +346,14 @@
VarSet0, N0, VarSet1, N1),
( { OpName = "," } ->
io__write_string(", ")
+ ; { OpName = "." } ->
+ % If the operator is '.'/2 then we must
+ % not put spaces around it (or at the
+ % very least, we should not put spaces
+ % afterwards, since otherwise it will
+ % not be seen as an operator by the parser.)
+ %
+ io__write_string(".")
;
io__write_char(' '),
term_io__write_constant(Functor),
Index: library/type_desc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/type_desc.m,v
retrieving revision 1.15
diff -u -r1.15 type_desc.m
--- library/type_desc.m 24 Oct 2002 17:11:45 -0000 1.15
+++ library/type_desc.m 17 Dec 2002 07:25:35 -0000
@@ -385,7 +385,7 @@
( ModuleName = "builtin" ->
TypeName = UnqualifiedTypeName
;
- string__append_list([ModuleName, ":",
+ string__append_list([ModuleName, ".",
UnqualifiedTypeName], TypeName)
).
Index: runtime/mercury_debug.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_debug.c,v
retrieving revision 1.12
diff -u -r1.12 mercury_debug.c
--- runtime/mercury_debug.c 14 Aug 2002 06:41:33 -0000 1.12
+++ runtime/mercury_debug.c 17 Dec 2002 02:23:25 -0000
@@ -837,7 +837,7 @@
proc_id->MR_proc_comp.MR_comp_arity,
proc_id->MR_proc_comp.MR_comp_mode);
} else {
- fprintf(fp, " %s:%s/%d-%d\n ",
+ fprintf(fp, " %s.%s/%d-%d\n ",
proc_id->MR_proc_user.
MR_user_decl_module,
proc_id->MR_proc_user.MR_user_name,
Index: runtime/mercury_deconstruct.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deconstruct.c,v
retrieving revision 1.11
diff -u -r1.11 mercury_deconstruct.c
--- runtime/mercury_deconstruct.c 1 Aug 2002 11:52:26 -0000 1.11
+++ runtime/mercury_deconstruct.c 17 Dec 2002 03:08:55 -0000
@@ -273,9 +273,9 @@
len = 0;
len += strlen(tci->MR_type_ctor_module_name);
- len += 1; /* : */
+ len += 1; /* '.' */
len += strlen(tci->MR_type_ctor_name);
- len += 1; /* / */
+ len += 1; /* '/' */
len += 4; /* arity; we do not support arities above 1024 */
if (wrap) {
len += 4; /* <<>> */
@@ -290,7 +290,7 @@
MR_allocate_aligned_string_msg(str, len, "MR_expand_type_name");
MR_save_transient_hp();
- sprintf(str, wrap? "<<%s:%s/%d>>" : "%s:%s/%d",
+ sprintf(str, wrap? "<<%s.%s/%d>>" : "%s.%s/%d",
tci->MR_type_ctor_module_name,
tci->MR_type_ctor_name,
tci->MR_type_ctor_arity);
Index: runtime/mercury_stack_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_trace.c,v
retrieving revision 1.51
diff -u -r1.51 mercury_stack_trace.c
--- runtime/mercury_stack_trace.c 6 Nov 2002 06:53:34 -0000 1.51
+++ runtime/mercury_stack_trace.c 17 Dec 2002 02:23:30 -0000
@@ -949,7 +949,7 @@
"for compiler generated procedures");
}
- fprintf(fp, "%s for %s:%s/%ld-%ld",
+ fprintf(fp, "%s for %s.%s/%ld-%ld",
entry->MR_sle_comp.MR_comp_pred_name,
entry->MR_sle_comp.MR_comp_type_module,
entry->MR_sle_comp.MR_comp_type_name,
@@ -976,7 +976,7 @@
fprintf(fp, " ");
}
- fprintf(fp, "%s:%s/%ld-%ld",
+ fprintf(fp, "%s.%s/%ld-%ld",
entry->MR_sle_user.MR_user_decl_module,
entry->MR_sle_user.MR_user_name,
(long) MR_sle_user_adjusted_arity(entry),
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list