cvs diff: make `div' an operator

Fergus Henderson fjh at cs.mu.oz.au
Wed Mar 19 06:57:11 AEDT 1997


Hi Tom,

Can you please review this diff?

-----------------------------------------------------------------------------

Make `div' an operator.

This is the first of a batch of changes.  I've split up the changes to
simplify the diffs and to minimize bootstrapping problems [though
boostrrapping will probably going to requre manual intervention anyway].
A later change will add `div' as a function in int.m.  The idea is that
`div' will be the same as `//', except that `div' will round toward
minus infinity, whereas `//' will round toward zero.

library/ops.m:
library/nc_builtin.nl:
library/sp_builtin.nl:
compiler/mercury_to_mercury.m:
	Add "div" as a new infix operator, with the same precedence
	and associativity as `//'.

Index: ops.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/ops.m,v
retrieving revision 1.14
diff -u -r1.14 ops.m
--- ops.m	1997/03/18 19:45:27	1.14
+++ ops.m	1997/03/18 19:48:03
@@ -160,6 +160,7 @@
 ops__op_table("^", after, xfy, 200).
 ops__op_table("all", before, fxy, 950).
 ops__op_table("and", after, xfy, 720).
+ops__op_table("div", after, yfx, 400).
 ops__op_table("else", after, xfy, 1170).
 ops__op_table("end_module", before, fx, 1199).
 ops__op_table("export_adt", before, fx, 1199).
Index: sp_builtin.nl
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/sp_builtin.nl,v
retrieving revision 1.11
diff -u -r1.11 sp_builtin.nl
--- sp_builtin.nl	1997/03/18 19:45:30	1.11
+++ sp_builtin.nl	1997/03/18 19:10:05
@@ -69,6 +69,7 @@
 :- op(701, xfx, (is)).
 
 :- op(400, yfx, (rem)).
+:- op(400, yfx, (div)).
 
 % Use term_expansion/2 to prevent warnings about undefined predicates
 % when the interpreter tries to execute the new declarations.
Index: nc_builtin.nl
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/nc_builtin.nl,v
retrieving revision 1.12
diff -u -r1.12 nc_builtin.nl
--- nc_builtin.nl	1997/03/18 19:45:28	1.12
+++ nc_builtin.nl	1997/03/18 19:10:13
@@ -53,6 +53,7 @@
 :- op(950, fxy, (lambda)).
 
 :- op(400, yfx, (rem)).
+:- op(400, yfx, (div)).
 
 % In NU-Prolog, ':' has precedence 1175, whereas according to the
 % ISO Prolog modules standard it should have precedence 600.
Index: ../compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.96
diff -u -r1.96 mercury_to_mercury.m
--- mercury_to_mercury.m	1997/03/18 19:46:10	1.96
+++ mercury_to_mercury.m	1997/03/18 19:50:21
@@ -1585,6 +1585,7 @@
 mercury_infix_op(">>").
 mercury_infix_op("<<").
 mercury_infix_op("**").
+mercury_infix_op("div").
 mercury_infix_op("mod").
 mercury_infix_op("rem").
 mercury_infix_op("^").

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list