[m-dev.] 0.13 release: op/3 syntax

Peter Schachte schachte at csse.unimelb.edu.au
Fri Mar 3 14:53:13 AEDT 2006


On Fri, Mar 03, 2006 at 02:10:15PM +1100, Ralph Becket wrote:
> What I was suggesting was that Doug write a general purpose
> pre-processor using the Mercury term_io library which would work like
> this:
> 
> 	repeat until EOF
> 		read in term from source file using own operator table
> 		if term = op/3 then
> 			update operator table
> 		else
> 			write out term in canonical form to target file
> 			(prepending #file and #line directives as
> 			appropriate)
> 
> And that's it.  It would take me about an hour to get this right, at the
> outside.

That's much closer.  But for this to work, there would have to be only
one such program, and every module that wants operators would have to
use that one, so this preprocessor needs to be a standard Mercury
tool.  Otherwise we're back to the problem of mixing operators from
different modules, and your argument breaks down.

But it's all still rather painful to work with the standard mmake and
mmc --make technology, so those should also be amended to do the
preprocessing automatically.

And as I've argued before, modules should be able to export operators
much as they do predicates and funtions.  So you'd need to modify your
preprocessor to read the interface sections of imported modules
looking for :- op declarations.  But OK, that's doable.

OK, now you've got the functionality right.  But unfortunately you've
slowed down compilation a bit, so it would be a good idea to do some
profiling and see if you can't speed it back up.  Maybe you could
removing the completely pointless process launch/read/write phase?
Not a huge expense, but you might as well merge the preprocessor into
the Mercury compiler.  Then you could also back out the changes to
mmake and mmc --make.

OK, that's got it.  :-)

-- 
Peter Schachte              Victory attained by violence is tantamount to a
schachte at cs.mu.OZ.AU        defeat, for it is momentary.
www.cs.mu.oz.au/~schachte/      -- Mahatma Gandhi 
Phone: +61 3 8344 1338      
--------------------------------------------------------------------------
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