[m-dev.] Adding `.' as a module separator

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Dec 2 15:45:19 AEDT 2002


On 02-Dec-2002, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> As I see it we have the following options:
> 
> 1. change the lexer to treat infix `.' as an operator and change the
> parser to recognise `.'/2 terms as module qualified names (this will
> cause merry Hell with backwards compatibility);

I think this is the right approach.  Why would this cause backwards
compatibility problems?

> * Actually, it would probably be easier and more consistent to hard-code
> in the module qualifiers.  The four uses of string_to_sym_name are
> 
> modules.m:		string_to_sym_name(FileName, ".", ModuleName)
> prog_io.m:		string_to_sym_name(Name, "__", SymName)
> prog_io_pragma.m:	string_to_sym_name(TypeNameStr, ".", TypeSymName)
> source_file_map.m:	string_to_sym_name(ModuleStr, ":", ModuleName)
> 
> which all starts to look a little redundant.

For modules.m, we are parsing a name specified on the command line.
These use "." as the separator since that is traditionally what is
used as a separator in filenames.

For prog_io.m, we are parsing a name that occurs in the middle of
some source file.  We use "__" here since that's what the current Mercury
syntax uses as (one of the two) module name separators.

For source_file_map.m, the separator used needs to match the one output
by the Mercury compiler, since the file it is parsing may have been
generated by the `-f' (`--generate-source-file-mapping') option.

For prog_io_pragma.m, it is parsing IL class names, so it needs to use
the IL class name separator (".").

So these all need to use different values for different reasons.
The "string" in "string_to_sym_name" represents something different
in each case.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list