[m-rev.] for review: more efficient operator lookups

Zoltan Somogyi zs at csse.unimelb.edu.au
Mon Sep 25 11:54:10 AEST 2006


For review by anyone. The diff to mercury_compile.m is not meant to be
committed; it was used only for measuring the performance impact. The results
showed that the time required to write out the HLDS for four of the largest
modules of the Mercury compiler went from 19.48, 4.96, 5.74 and 4.42 seconds
to 19.10, 4.80, 5.59 and 4.26 seconds respectively.

Zoltan.

library/ops.m:
	Change the representation of operators to allow a single lookup to
	gather all available information about an operator.

NEWS:
	Mention the change to ops.m.

library/io.m:
	When writing out terms, use the new functionality of ops.m to look up
	the function symbol in the operator table just one (previously we did
	it up to five times).

	Rename some predicates to eliminate some ambiguities.

cvs diff: Diffing .
Index: NEWS
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/NEWS,v
retrieving revision 1.424
diff -u -b -r1.424 NEWS
--- NEWS	20 Sep 2006 09:41:57 -0000	1.424
+++ NEWS	24 Sep 2006 11:02:48 -0000
@@ -13,6 +13,9 @@
 
 Changes to the Mercury standard library:
 
+* We have changed the interface of the ops module to make lookups of operators
+  more efficient.
+
 * We have added list.map2_foldl3/10, list.map_corresponding_foldl/6 and
   list.map_corresponding3_foldl/7 
 
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.404
diff -u -b -r1.404 mercury_compile.m
--- compiler/mercury_compile.m	20 Sep 2006 09:42:06 -0000	1.404
+++ compiler/mercury_compile.m	21 Sep 2006 03:34:57 -0000
@@ -2526,6 +2526,29 @@
     map_args_to_regs(Verbose, Stats, !HLDS, !IO),
     maybe_dump_hlds(!.HLDS, 305, "args_to_regs", !DumpInfo, !IO),
 
+    globals.io_lookup_string_option(experiment, Exp, !IO),
+    ( Exp = "" ->
+        true
+    ;
+        io.write_string("Before dumping out the HLDS\n", !IO),
+        io.flush_output(!IO),
+        io.report_stats(!IO),
+        io.tell(Exp, Res, !IO),
+        (
+            Res = ok,
+            io.write(!.HLDS, !IO),
+            io.told(!IO)
+        ;
+            Res = error(_),
+            io.format("Dump to %s failed\n", [s(Exp)], !IO),
+            io.flush_output(!IO)
+        ),
+        io.write_string("After dumping out the HLDS\n", !IO),
+        io.flush_output(!IO),
+        io.report_stats(!IO),
+        io.nl(!IO)
+    ),
+
     globals.io_lookup_bool_option(trad_passes, TradPasses, !IO),
     (
         TradPasses = no,
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
Index: library/io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.356
diff -u -b -r1.356 io.m
--- library/io.m	20 Sep 2006 09:42:23 -0000	1.356
+++ library/io.m	21 Sep 2006 05:12:34 -0000
@@ -3867,16 +3867,17 @@
 
 io.do_write_univ(NonCanon, Univ, !IO) :-
     io.get_op_table(OpTable, !IO),
-    io.do_write_univ(NonCanon, Univ, ops.max_priority(OpTable) + 1, !IO).
+    io.do_write_univ_prio(NonCanon, Univ, ops.max_priority(OpTable) + 1, !IO).
 
-:- pred io.do_write_univ(deconstruct.noncanon_handling, univ, ops.priority,
+:- pred io.do_write_univ_prio(deconstruct.noncanon_handling, univ, ops.priority,
     io, io).
-:- mode io.do_write_univ(in(do_not_allow), in, in, di, uo) is det.
-:- mode io.do_write_univ(in(canonicalize), in, in, di, uo) is det.
-:- mode io.do_write_univ(in(include_details_cc), in, in, di, uo) is cc_multi.
-:- mode io.do_write_univ(in, in, in, di, uo) is cc_multi.
+:- mode io.do_write_univ_prio(in(do_not_allow), in, in, di, uo) is det.
+:- mode io.do_write_univ_prio(in(canonicalize), in, in, di, uo) is det.
+:- mode io.do_write_univ_prio(in(include_details_cc), in, in, di, uo)
+    is cc_multi.
+:- mode io.do_write_univ_prio(in, in, in, di, uo) is cc_multi.
 
-io.do_write_univ(NonCanon, Univ, Priority, !IO) :-
+io.do_write_univ_prio(NonCanon, Univ, Priority, !IO) :-
     % We need to special-case the builtin types:
     %   int, char, float, string
     %   type_info, univ, c_pointer, array
@@ -3898,7 +3899,7 @@
         io.get_stream_db(StreamDb, !IO),
         io.maybe_stream_info(StreamDb, Stream) = StreamInfo,
         type_to_univ(StreamInfo, StreamInfoUniv),
-        io.do_write_univ(NonCanon, StreamInfoUniv, Priority, !IO)
+        io.do_write_univ_prio(NonCanon, StreamInfoUniv, Priority, !IO)
     ; univ_to_type(Univ, C_Pointer) ->
         io.write_c_pointer(C_Pointer, !IO)
     ;
@@ -3980,47 +3981,80 @@
         io.write_string("[]", !IO)
     ;
         Functor = "{}",
-        Args = [BracedTerm]
+        Args = [BracedHead | BracedTail]
     ->
+        (
+            BracedTail = [],
         io.write_string("{ ", !IO),
-        io.do_write_univ(NonCanon, BracedTerm, !IO),
+            io.do_write_univ(NonCanon, BracedHead, !IO),
         io.write_string(" }", !IO)
     ;
-        Functor = "{}",
-        Args = [BracedHead | BracedTail]
-    ->
+            BracedTail = [_ | _],
         io.write_char('{', !IO),
         io.write_arg(NonCanon, BracedHead, !IO),
         io.write_term_args(NonCanon, BracedTail, !IO),
         io.write_char('}', !IO)
+        )
     ;
-        Args = [PrefixArg],
-        ops.lookup_prefix_op(OpTable, Functor, OpPriority, OpAssoc)
+        ops.lookup_op_infos(OpTable, Functor, FirstOpInfo, OtherOpInfos)
     ->
+        select_op_info_and_print(NonCanon, FirstOpInfo, OtherOpInfos,
+            Priority, Functor, Args, !IO)
+    ;
+        io.write_functor_and_args(NonCanon, Functor, Args, !IO)
+    ).
+
+:- pred select_op_info_and_print(deconstruct.noncanon_handling,
+    op_info, list(op_info), ops.priority, string, list(univ), io, io) is det.
+:- mode select_op_info_and_print(in(do_not_allow), in, in, in, in, in, di, uo)
+    is det.
+:- mode select_op_info_and_print(in(canonicalize), in, in, in, in, in, di, uo)
+    is det.
+:- mode select_op_info_and_print(in(include_details_cc), in, in, in, in, in,
+    di, uo) is cc_multi.
+:- mode select_op_info_and_print(in, in, in, in, in, in, di, uo) is cc_multi.
+
+select_op_info_and_print(NonCanon, OpInfo, OtherOpInfos, Priority,
+        Functor, Args, !IO) :-
+    OpInfo = op_info(OpClass, _),
+    (
+        OpClass = prefix(_OpAssoc),
+        ( Args = [Arg] ->
+            OpInfo = op_info(_, OpPriority),
         maybe_write_paren('(', Priority, OpPriority, !IO),
         term_io.quote_atom(Functor, !IO),
         io.write_char(' ', !IO),
+            OpClass = prefix(OpAssoc),
         adjust_priority_for_assoc(OpPriority, OpAssoc, NewPriority),
-        io.do_write_univ(NonCanon, PrefixArg, NewPriority, !IO),
+            io.do_write_univ_prio(NonCanon, Arg, NewPriority, !IO),
         maybe_write_paren(')', Priority, OpPriority, !IO)
     ;
-        Args = [PostfixArg],
-        ops.lookup_postfix_op(OpTable, Functor, OpPriority, OpAssoc)
-    ->
+            select_remaining_op_info_and_print(NonCanon, OtherOpInfos,
+                Priority, Functor, Args, !IO)
+        )
+    ;
+        OpClass = postfix(_OpAssoc),
+        ( Args = [PostfixArg] ->
+            OpInfo = op_info(_, OpPriority),
         maybe_write_paren('(', Priority, OpPriority, !IO),
+            OpClass = postfix(OpAssoc),
         adjust_priority_for_assoc(OpPriority, OpAssoc, NewPriority),
-        io.do_write_univ(NonCanon, PostfixArg, NewPriority, !IO),
+            io.do_write_univ_prio(NonCanon, PostfixArg, NewPriority, !IO),
         io.write_char(' ', !IO),
         term_io.quote_atom(Functor, !IO),
         maybe_write_paren(')', Priority, OpPriority, !IO)
     ;
-        Args = [Arg1, Arg2],
-        ops.lookup_infix_op(OpTable, Functor, OpPriority,
-            LeftAssoc, RightAssoc)
-    ->
+            select_remaining_op_info_and_print(NonCanon, OtherOpInfos,
+                Priority, Functor, Args, !IO)
+        )
+    ;
+        OpClass = infix(_LeftAssoc, _RightAssoc),
+        ( Args = [Arg1, Arg2] ->
+            OpInfo = op_info(_, OpPriority),
         maybe_write_paren('(', Priority, OpPriority, !IO),
+            OpClass = infix(LeftAssoc, _),
         adjust_priority_for_assoc(OpPriority, LeftAssoc, LeftPriority),
-        io.do_write_univ(NonCanon, Arg1, LeftPriority, !IO),
+            io.do_write_univ_prio(NonCanon, Arg1, LeftPriority, !IO),
         ( Functor = "," ->
             io.write_string(", ", !IO)
         ;
@@ -4028,51 +4062,95 @@
             term_io.quote_atom(Functor, !IO),
             io.write_char(' ', !IO)
         ),
+            OpClass = infix(_, RightAssoc),
         adjust_priority_for_assoc(OpPriority, RightAssoc, RightPriority),
-        io.do_write_univ(NonCanon, Arg2, RightPriority, !IO),
+            io.do_write_univ_prio(NonCanon, Arg2, RightPriority, !IO),
         maybe_write_paren(')', Priority, OpPriority, !IO)
     ;
-        Args = [Arg1, Arg2],
-        ops.lookup_binary_prefix_op(OpTable, Functor, OpPriority,
-            FirstAssoc, SecondAssoc)
-    ->
+            select_remaining_op_info_and_print(NonCanon, OtherOpInfos,
+                Priority, Functor, Args, !IO)
+        )
+    ;
+        OpClass = binary_prefix(_FirstAssoc, _SecondAssoc),
+        ( Args = [Arg1, Arg2] ->
+            OpInfo = op_info(_, OpPriority),
         maybe_write_paren('(', Priority, OpPriority, !IO),
         term_io.quote_atom(Functor, !IO),
         io.write_char(' ', !IO),
-        adjust_priority_for_assoc(OpPriority, FirstAssoc, FirstPriority),
-        io.do_write_univ(NonCanon, Arg1, FirstPriority, !IO),
+            OpClass = binary_prefix(FirstAssoc, _),
+            adjust_priority_for_assoc(OpPriority, FirstAssoc,
+                FirstPriority),
+            io.do_write_univ_prio(NonCanon, Arg1, FirstPriority, !IO),
         io.write_char(' ', !IO),
-        adjust_priority_for_assoc(OpPriority, SecondAssoc, SecondPriority),
-        io.do_write_univ(NonCanon, Arg2, SecondPriority, !IO),
+            OpClass = binary_prefix(_, SecondAssoc),
+            adjust_priority_for_assoc(OpPriority, SecondAssoc,
+                SecondPriority),
+            io.do_write_univ_prio(NonCanon, Arg2, SecondPriority, !IO),
         maybe_write_paren(')', Priority, OpPriority, !IO)
     ;
+            select_remaining_op_info_and_print(NonCanon, OtherOpInfos,
+                Priority, Functor, Args, !IO)
+        )
+    ).
+
+:- pred select_remaining_op_info_and_print(deconstruct.noncanon_handling,
+    list(op_info), ops.priority, string, list(univ), io, io) is det.
+:- mode select_remaining_op_info_and_print(in(do_not_allow), in, in, in, in,
+    di, uo) is det.
+:- mode select_remaining_op_info_and_print(in(canonicalize), in, in, in, in,
+    di, uo) is det.
+:- mode select_remaining_op_info_and_print(in(include_details_cc), in, in, in,
+    in, di, uo) is cc_multi.
+:- mode select_remaining_op_info_and_print(in, in, in, in, in, di, uo)
+    is cc_multi.
+
+select_remaining_op_info_and_print(NonCanon, [FirstOpInfo | MoreOpInfos],
+        Priority, Functor, Args, !IO) :-
+    select_op_info_and_print(NonCanon, FirstOpInfo, MoreOpInfos,
+        Priority, Functor, Args, !IO).
+select_remaining_op_info_and_print(NonCanon, [],
+        Priority, Functor, Args, !IO) :-
+    io.get_op_table(OpTable, !IO),
         (
             Args = [],
-            ops.lookup_op(OpTable, Functor),
             Priority =< ops.max_priority(OpTable)
         ->
             io.write_char('(', !IO),
             term_io.quote_atom(Functor, !IO),
             io.write_char(')', !IO)
         ;
-            term_io.quote_atom_agt(Functor, maybe_adjacent_to_graphic_token,
-                !IO)
-        ),
+        io.write_functor_and_args(NonCanon, Functor, Args, !IO)
+    ).
+
+:- pred io.write_functor_and_args(deconstruct.noncanon_handling, string,
+    list(univ), io, io).
+:- mode io.write_functor_and_args(in(do_not_allow), in, in, di, uo) is det.
+:- mode io.write_functor_and_args(in(canonicalize), in, in, di, uo) is det.
+:- mode io.write_functor_and_args(in(include_details_cc), in, in, di, uo)
+    is cc_multi.
+:- mode io.write_functor_and_args(in, in, in, di, uo) is cc_multi.
+
+:- pragma inline(io.write_functor_and_args/5).
+
+io.write_functor_and_args(NonCanon, Functor, Args, !IO) :-
+    term_io.quote_atom_agt(Functor, maybe_adjacent_to_graphic_token, !IO),
         (
-            Args = [X | Xs]
-        ->
+        Args = [X | Xs],
             io.write_char('(', !IO),
             io.write_arg(NonCanon, X, !IO),
             io.write_term_args(NonCanon, Xs, !IO),
             io.write_char(')', !IO)
         ;
-            true
-        )
+        Args = []
     ).
 
+:- pragma inline(adjust_priority_for_assoc/3).
+
 adjust_priority_for_assoc(Priority, y, Priority).
 adjust_priority_for_assoc(Priority, x, Priority - 1).
 
+:- pragma inline(maybe_write_paren/5).
+
 maybe_write_paren(Char, Priority, OpPriority, !IO) :-
     ( OpPriority > Priority ->
         io.write_char(Char, !IO)
@@ -4129,7 +4207,7 @@
 
 io.write_arg(NonCanon, X, !IO) :-
     arg_priority(ArgPriority, !IO),
-    io.do_write_univ(NonCanon, X, ArgPriority, !IO).
+    io.do_write_univ_prio(NonCanon, X, ArgPriority, !IO).
 
 :- pred arg_priority(int::out, io::di, io::uo) is det.
 
Index: library/ops.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/ops.m,v
retrieving revision 1.65
diff -u -b -r1.65 ops.m
--- library/ops.m	5 Sep 2006 06:21:37 -0000	1.65
+++ library/ops.m	20 Sep 2006 11:49:01 -0000
@@ -28,6 +28,43 @@
 :- module ops.
 :- interface.
 
+:- import_module list.
+
+%-----------------------------------------------------------------------------%
+
+    % An ops.class describes what structure terms constructed with an operator
+    % of that class are allowed to take.
+:- type ops.class
+    --->    infix(ops.assoc, ops.assoc)             % term Op term
+    ;       prefix(ops.assoc)                       % Op term
+    ;       binary_prefix(ops.assoc, ops.assoc)     % Op term term
+    ;       postfix(ops.assoc).                     % term Op
+
+    % `x' represents an argument whose priority must be
+    % strictly lower than the priority of the operator.
+    % `y' represents an argument whose priority must be
+    % lower than or equal to the priority of the operator.
+:- type ops.assoc
+    --->    x
+    ;       y.
+
+    % Operators with a low "priority" bind more tightly than those
+    % with a high "priority". For example, given that `+' has
+    % priority 500 and `*' has priority 400, the term `2 * X + Y'
+    % would parse as `(2 * X) + Y'.
+    %
+    % The lowest priority is 0.
+    %
+:- type ops.priority == int.
+
+:- type ops.op_info
+    --->    op_info(
+                ops.class,
+                ops.priority  
+            ).
+
+%-----------------------------------------------------------------------------%
+
 :- typeclass ops.op_table(Table) where [
 
         % Check whether a string is the name of an infix operator,
@@ -36,27 +73,17 @@
     pred ops.lookup_infix_op(Table::in, string::in, ops.priority::out,
         ops.assoc::out, ops.assoc::out) is semidet,
 
-        % Operator terms are terms of the form `X `Op` Y',
-        % where `Op' is a variable or a name and `X' and `Y'
-        % are terms. If operator terms are included in `Table',
-        % return their precedence and associativity.
-        %
-    pred ops.lookup_operator_term(Table::in, ops.priority::out,
-        ops.assoc::out, ops.assoc::out) is semidet,
-
         % Check whether a string is the name of a prefix operator,
         % and if it is, return its precedence and associativity.
         %
     pred ops.lookup_prefix_op(Table::in, string::in,
         ops.priority::out, ops.assoc::out) is semidet,
 
-        % Check whether a string is the name of a binary prefix
-        % operator, and if it is, return its precedence and
-        % associativity.
+        % Check whether a string is the name of a binary prefix operator,
+        % and if it is, return its precedence and associativity.
         %
     pred ops.lookup_binary_prefix_op(Table::in, string::in,
-        ops.priority::out, ops.assoc::out, ops.assoc::out)
-        is semidet,
+        ops.priority::out, ops.assoc::out, ops.assoc::out) is semidet,
 
         % Check whether a string is the name of a postfix operator,
         % and if it is, return its precedence and associativity.
@@ -64,21 +91,35 @@
     pred ops.lookup_postfix_op(Table::in, string::in, ops.priority::out,
         ops.assoc::out) is semidet,
 
-        % Check whether a string is the name of an operator
+        % Check whether a string is the name of an operator.
         %
     pred ops.lookup_op(Table::in, string::in) is semidet,
 
+        % Check whether a string is the name of an operator, and if it is,
+        % return the op_info describing that operator in the third argument.
+        % If the string is the name of more than one operator, return
+        % information about its other guises in the last argument.
+        %
+    pred ops.lookup_op_infos(Table::in, string::in,
+        op_info::out, list(op_info)::out) is semidet,
+
+        % Operator terms are terms of the form `X `Op` Y', where `Op' is
+        % a variable or a name and `X' and `Y' are terms. If operator terms
+        % are included in `Table', return their precedence and associativity.
+        %
+    pred ops.lookup_operator_term(Table::in, ops.priority::out,
+        ops.assoc::out, ops.assoc::out) is semidet,
+
         % Returns the highest priority number (the lowest is zero).
         %
     func ops.max_priority(Table) = ops.priority,
 
-        % The maximum priority of an operator appearing
-        % as the top-level functor of an argument of a compound
-        % term.
+        % The maximum priority of an operator appearing as the top-level
+        % functor of an argument of a compound term.
         %
         % This will generally be the precedence of `,/2' less one.
-        % If `,/2' does not appear in the op_table,
-        % `ops.max_priority' plus one may be a reasonable value.
+        % If `,/2' does not appear in the op_table, `ops.max_priority' plus one
+        % may be a reasonable value.
         %
     func ops.arg_priority(Table) = ops.priority
 ].
@@ -96,56 +137,6 @@
 
 %-----------------------------------------------------------------------------%
 
-    % Operators with a low "priority" bind more tightly than those
-    % with a high "priority". For example, given that `+' has
-    % priority 500 and `*' has priority 400, the term `2 * X + Y'
-    % would parse as `(2 * X) + Y'.
-    %
-    % The lowest priority is 0.
-    %
-:- type ops.priority == int.
-
-%-----------------------------------------------------------------------------%
-
-    % An ops.specifier describes what structure terms
-    % constructed with an operator are allowed to take.
-    % `f' represents the operator and `x' and `y' represent arguments.
-    % `x' represents an argument whose priority must be
-    % strictly lower than that of the operator.
-    % `y' represents an argument whose priority is
-    % lower or equal to that of the operator.
-    % For example, `yfx' indicates a left-associative infix operator,
-    % while `xfy' indicates a right-associative infix operator.
-    %
-:- type ops.specifier
-    --->    fx
-    ;       fy
-    ;       xf
-    ;       yf
-    ;       xfx
-    ;       yfx
-    ;       xfy
-    ;       fxx
-    ;       fxy
-    ;       fyx.
-
-:- type ops.assoc
-    --->    x
-    ;       y.
-
-:- type ops.class
-    --->    infix(ops.assoc, ops.assoc)
-    ;       prefix(ops.assoc)
-    ;       binary_prefix(ops.assoc, ops.assoc)
-    ;       postfix(ops.assoc).
-
-    % convert an ops.specifer (e.g. `xfy') to an ops.class
-    % (e.g. `infix(x, y)').
-    %
-:- pred ops.op_specifier_to_class(ops.specifier::in, ops.class::out) is det.
-
-%-----------------------------------------------------------------------------%
-
 :- implementation.
 
 % Anything below here is not documented in the library reference manual.
@@ -160,38 +151,20 @@
 
 :- implementation.
 
-ops.op_specifier_to_class(fx, prefix(x)).
-ops.op_specifier_to_class(fy, prefix(y)).
-ops.op_specifier_to_class(xf, postfix(x)).
-ops.op_specifier_to_class(yf, postfix(y)).
-ops.op_specifier_to_class(xfx, infix(x,x)).
-ops.op_specifier_to_class(yfx, infix(y,x)).
-ops.op_specifier_to_class(xfy, infix(x,y)).
-ops.op_specifier_to_class(fxx, binary_prefix(x,x)).
-ops.op_specifier_to_class(fyx, binary_prefix(y,x)).
-ops.op_specifier_to_class(fxy, binary_prefix(x,y)).
-
 :- type ops.mercury_op_table
     --->    ops.mercury_op_table.
 
-    % ops.category is used to index the op_table so that
-    % lookups are semidet rather than nondet.
-    % Prefix and binary_prefix operators have ops.category `before'.
-    % Infix and postfix operators have ops.category `after'.
-:- type ops.category
-    --->    before
-    ;       after.
-
 ops.init_mercury_op_table = ops.mercury_op_table.
 
 :- instance ops.op_table(ops.mercury_op_table) where [
     pred(ops.lookup_infix_op/5) is ops.lookup_mercury_infix_op,
-    pred(ops.lookup_operator_term/4) is ops.lookup_mercury_operator_term,
     pred(ops.lookup_prefix_op/4) is ops.lookup_mercury_prefix_op,
     pred(ops.lookup_binary_prefix_op/5) is
         ops.lookup_mercury_binary_prefix_op,
     pred(ops.lookup_postfix_op/4) is ops.lookup_mercury_postfix_op,
     pred(ops.lookup_op/2) is ops.lookup_mercury_op,
+    pred(ops.lookup_op_infos/4) is ops.lookup_mercury_op_infos,
+    pred(ops.lookup_operator_term/4) is ops.lookup_mercury_operator_term,
     func(ops.max_priority/1) is ops.mercury_max_priority,
     func(ops.arg_priority/1) is ops.mercury_arg_priority
 ].
@@ -201,43 +174,95 @@
 
 ops.lookup_mercury_infix_op(_OpTable, Name, Priority,
         LeftAssoc, RightAssoc) :-
-    ops.op_table(Name, after, Specifier, Priority),
-    ops.op_specifier_to_class(Specifier, infix(LeftAssoc, RightAssoc)).
-
-:- pred ops.lookup_mercury_operator_term(mercury_op_table::in,
-    ops.priority::out, ops.assoc::out, ops.assoc::out) is det.
-
-    % Left associative, lower priority than everything
-    % except record syntax.
-ops.lookup_mercury_operator_term(_OpTable, 120, y, x).
+    ops.op_table(Name, Info, MaybeOtherInfo),
+    (
+        Info = op_info(Class, PriorityPrime),
+        Class = infix(LeftAssocPrime, RightAssocPrime)
+    ->
+        LeftAssoc = LeftAssocPrime,
+        RightAssoc = RightAssocPrime,
+        Priority = PriorityPrime
+    ;
+        MaybeOtherInfo = [op_info(Class, PriorityPrime)],
+        Class = infix(LeftAssocPrime, RightAssocPrime)
+    ->
+        LeftAssoc = LeftAssocPrime,
+        RightAssoc = RightAssocPrime,
+        Priority = PriorityPrime
+    ;
+        fail
+    ).
 
 :- pred ops.lookup_mercury_prefix_op(mercury_op_table::in,
     string::in, ops.priority::out, ops.assoc::out) is semidet.
 
 ops.lookup_mercury_prefix_op(_OpTable, Name, Priority, LeftAssoc) :-
-    ops.op_table(Name, before, Specifier, Priority),
-    ops.op_specifier_to_class(Specifier, prefix(LeftAssoc)).
+    ops.op_table(Name, Info, MaybeOtherInfo),
+    ( Info = op_info(prefix(LeftAssocPrime), PriorityPrime) ->
+        LeftAssoc = LeftAssocPrime,
+        Priority = PriorityPrime
+    ; MaybeOtherInfo = [op_info(prefix(LeftAssocPrime), PriorityPrime)] ->
+        LeftAssoc = LeftAssocPrime,
+        Priority = PriorityPrime
+    ;
+        fail
+    ).
 
 :- pred ops.lookup_mercury_binary_prefix_op(mercury_op_table::in, string::in,
     ops.priority::out, ops.assoc::out, ops.assoc::out) is semidet.
 
 ops.lookup_mercury_binary_prefix_op(_OpTable, Name, Priority,
         LeftAssoc, RightAssoc) :-
-    ops.op_table(Name, before, Specifier, Priority),
-    ops.op_specifier_to_class(Specifier,
-        binary_prefix(LeftAssoc, RightAssoc)).
+    ops.op_table(Name, Info, MaybeOtherInfo),
+    (
+        Info = op_info(Class, PriorityPrime),
+        Class = binary_prefix(LeftAssocPrime, RightAssocPrime)
+    ->
+        LeftAssoc = LeftAssocPrime,
+        RightAssoc = RightAssocPrime,
+        Priority = PriorityPrime
+    ;
+        MaybeOtherInfo = [op_info(Class, PriorityPrime)],
+        Class = binary_prefix(LeftAssocPrime, RightAssocPrime)
+    ->
+        LeftAssoc = LeftAssocPrime,
+        RightAssoc = RightAssocPrime,
+        Priority = PriorityPrime
+    ;
+        fail
+    ).
 
 :- pred ops.lookup_mercury_postfix_op(mercury_op_table::in,
     string::in, ops.priority::out, ops.assoc::out) is semidet.
 
 ops.lookup_mercury_postfix_op(_OpTable, Name, Priority, LeftAssoc) :-
-    ops.op_table(Name, after, Specifier, Priority),
-    ops.op_specifier_to_class(Specifier, postfix(LeftAssoc)).
+    ops.op_table(Name, Info, MaybeOtherInfo),
+    ( Info = op_info(postfix(LeftAssocPrime), PriorityPrime) ->
+        LeftAssoc = LeftAssocPrime,
+        Priority = PriorityPrime
+    ; MaybeOtherInfo = [op_info(postfix(LeftAssocPrime), PriorityPrime)] ->
+        LeftAssoc = LeftAssocPrime,
+        Priority = PriorityPrime
+    ;
+        fail
+    ).
 
 :- pred ops.lookup_mercury_op(mercury_op_table::in, string::in) is semidet.
 
 ops.lookup_mercury_op(_OpTable, Name) :-
-    ops.op_table(Name, _, _, _).
+    ops.op_table(Name, _, _).
+
+:- pred ops.lookup_mercury_op_infos(mercury_op_table::in, string::in,
+    op_info::out, list(op_info)::out) is semidet.
+
+ops.lookup_mercury_op_infos(_OpTable, Name, Info, OtherInfos) :-
+    ops.op_table(Name, Info, OtherInfos).
+
+:- pred ops.lookup_mercury_operator_term(mercury_op_table::in,
+    ops.priority::out, ops.assoc::out, ops.assoc::out) is det.
+
+    % Left associative, lower priority than everything except record syntax.
+ops.lookup_mercury_operator_term(_OpTable, 120, y, x).
 
 :- func ops.mercury_max_priority(mercury_op_table) = ops.priority.
 
@@ -248,128 +273,176 @@
     % This needs to be less than the priority of the ','/2 operator.
 ops.mercury_arg_priority(_Table) = 999.
 
-    % Changes here may require changes to doc/reference_manual.texi.
-:- pred ops.op_table(string, ops.category, ops.specifier, ops.priority).
-:- mode ops.op_table(in, in, out, out) is semidet.
-:- mode ops.op_table(in, out, out, out) is nondet.
-
-ops.op_table("..", after, xfx, 550).       % Mercury extension
-ops.op_table("*", after, yfx, 400).        % standard ISO Prolog
-ops.op_table("**", after, xfy, 200).       % standard ISO Prolog
-ops.op_table("+", after, yfx, 500).        % standard ISO Prolog
-ops.op_table("++", after, xfy, 500).       % Mercury extension
-ops.op_table("+", before, fx, 500).        % traditional Prolog (not ISO)
-ops.op_table(",", after, xfy, 1000).       % standard ISO Prolog
-ops.op_table("&", after, xfy, 1025).       % Mercury extension
-ops.op_table("-", after, yfx, 500).        % standard ISO Prolog
-ops.op_table("--", after, yfx, 500).       % Mercury extension
-ops.op_table("-", before, fx, 200).        % standard ISO Prolog
-ops.op_table("--->", after, xfy, 1179).    % Mercury extension
-ops.op_table("-->", after, xfx, 1200).     % standard ISO Prolog
-ops.op_table("->", after, xfy, 1050).      % standard ISO Prolog
-ops.op_table(".", after, yfx, 10).         % Mercury extension
-ops.op_table("/", after, yfx, 400).        % standard ISO Prolog
-ops.op_table("//", after, yfx, 400).       % standard ISO Prolog
-ops.op_table("/\\", after, yfx, 500).      % standard ISO Prolog
-ops.op_table(":", after, yfx, 120).        % Mercury extension
-ops.op_table(":-", after, xfx, 1200).      % standard ISO Prolog
-ops.op_table(":-", before, fx, 1200).      % standard ISO Prolog
-ops.op_table("::", after, xfx, 1175).      % Mercury extension
-ops.op_table(":=", after, xfx, 650).       % Mercury extension
-ops.op_table(";", after, xfy, 1100).       % standard ISO Prolog
-ops.op_table("<", after, xfx, 700).        % standard ISO Prolog
-ops.op_table("<<", after, yfx, 400).       % standard ISO Prolog
-ops.op_table("<=", after, xfy, 920).       % Mercury/NU-Prolog extension
-ops.op_table("<=>", after, xfy, 920).      % Mercury/NU-Prolog extension
-ops.op_table("=", after, xfx, 700).        % standard ISO Prolog
-ops.op_table("=..", after, xfx, 700).      % standard ISO Prolog
-ops.op_table("=:=", after, xfx, 700).      % standard ISO Prolog (*)
-ops.op_table("=<", after, xfx, 700).       % standard ISO Prolog
-ops.op_table("==", after, xfx, 700).       % standard ISO Prolog (*)
-ops.op_table("==>", after, xfx, 1175).     % Mercury extension
-ops.op_table("=>", after, xfy, 920).       % Mercury/NU-Prolog extension
-ops.op_table("=\\=", after, xfx, 700).     % standard ISO Prolog (*)
-ops.op_table("=^", after, xfx, 650).       % Mercury extension
-ops.op_table(">", after, xfx, 700).        % standard ISO Prolog
-ops.op_table(">=", after, xfx, 700).       % standard ISO Prolog
-ops.op_table(">>", after, yfx, 400).       % standard ISO Prolog
-ops.op_table("?-", before, fx, 1200).      % standard ISO Prolog (*)
-ops.op_table("@", after, xfx, 90).         % Mercury extension
-ops.op_table("@<", after, xfx, 700).       % standard ISO Prolog
-ops.op_table("@=<", after, xfx, 700).      % standard ISO Prolog
-ops.op_table("@>", after, xfx, 700).       % standard ISO Prolog
-ops.op_table("@>=", after, xfx, 700).      % standard ISO Prolog
-ops.op_table("\\", before, fx, 200).       % standard ISO Prolog
-ops.op_table("\\+", before, fy, 900).      % standard ISO Prolog
-ops.op_table("\\/", after, yfx, 500).      % standard ISO Prolog
-ops.op_table("\\=", after, xfx, 700).      % standard ISO Prolog
-ops.op_table("\\==", after, xfx, 700).     % standard ISO Prolog (*)
-ops.op_table("^", after, xfy, 99).         % ISO Prolog (prec. 200,
-                                            %   bitwise xor)
-                                            % Mercury (record syntax)
-ops.op_table("^", before, fx, 100).        % Mercury extension
-                                            % (record syntax)
-ops.op_table("all", before, fxy, 950).     % Mercury/NU-Prolog extension
-ops.op_table("and", after, xfy, 720).      % NU-Prolog extension
-ops.op_table("div", after, yfx, 400).      % standard ISO Prolog
-ops.op_table("else", after, xfy, 1170).    % Mercury/NU-Prolog extension
-ops.op_table("end_module", before, fx, 1199).  % Mercury extension
-ops.op_table("func", before, fx, 800).     % Mercury extension
-ops.op_table("if", before, fx, 1160).      % Mercury/NU-Prolog extension
-ops.op_table("import_module", before, fx, 1199). % Mercury extension
-ops.op_table("include_module", before, fx, 1199). % Mercury extension
-ops.op_table("impure", before, fy, 800).   % Mercury extension
-ops.op_table("initialise", before, fx, 1199).  % Mercury extension
-ops.op_table("initialize", before, fx, 1199).  % Mercury extension
-ops.op_table("finalise", before, fx, 1199).    % Mercury extension
-ops.op_table("finalize", before, fx, 1199).    % Mercury extension
-ops.op_table("inst", before, fx, 1199).    % Mercury extension
-ops.op_table("instance", before, fx, 1199).    % Mercury extension
-ops.op_table("is", after, xfx, 701).       % ISO Prolog says prec 700
-ops.op_table("mod", after, xfx, 400).      % Standard ISO Prolog
-ops.op_table("mode", before, fx, 1199).    % Mercury extension
-ops.op_table("module", before, fx, 1199).  % Mercury extension
-ops.op_table("not", before, fy, 900).      % Mercury/NU-Prolog extension
-ops.op_table("or", after, xfy, 740).       % NU-Prolog extension
-ops.op_table("pragma", before, fx, 1199).  % Mercury extension
-ops.op_table("pred", before, fx, 800).     % Mercury/NU-Prolog extension
-ops.op_table("promise", before, fx, 1199). % Mercury extension
-ops.op_table("trace", before, fxy, 950).   % Mercury extension
-ops.op_table("event", before, fx, 100).    % Mercury extension
-ops.op_table("promise_exclusive", before, fy, 950). % Mercury extension
-ops.op_table("promise_exhaustive", before, fy, 950). % Mercury extension
-ops.op_table("promise_exclusive_exhaustive", before, fy, 950).
-                                            % Mercury extension
-ops.op_table("rem", after, xfx, 400).      % Standard ISO Prolog
-ops.op_table("rule", before, fx, 1199).    % NU-Prolog extension
-ops.op_table("semipure", before, fy, 800). % Mercury extension
-ops.op_table("solver", before, fy, 1181).  % Mercury extension
-ops.op_table("promise_pure", before, fx, 950). % Mercury extension
-ops.op_table("promise_impure", before, fx, 950).   % Mercury extension
-ops.op_table("promise_semipure", before, fx, 950). % Mercury extension
-ops.op_table("promise_pure_implicit", before, fx, 950).    % Mercury extension
-ops.op_table("promise_impure_implicit", before, fx, 950).  % Mercury extension
-ops.op_table("promise_semipure_implicit", before, fx, 950).% Mercury extension
-ops.op_table("promise_equivalent_solutions", before, fxy, 950).
-                                           % Mercury extension
-ops.op_table("promise_equivalent_solution_sets", before, fxy, 950).
-                                           % Mercury extension
-ops.op_table("arbitrary", before, fxy, 950).
-                                           % Mercury extension
-ops.op_table("some", before, fxy, 950).    % Mercury/NU-Prolog extension
-ops.op_table("then", after, xfx, 1150).    % Mercury/NU-Prolog extension
-ops.op_table("type", before, fx, 1180).    % Mercury extension
-ops.op_table("typeclass", before, fx, 1199).   % Mercury extension
-ops.op_table("use_module", before, fx, 1199).  % Mercury extension
-ops.op_table("when", after, xfx, 900).     % NU-Prolog extension (*)
-ops.op_table("where", after, xfx, 1175).   % NU-Prolog extension (*)
-ops.op_table("~", before, fy, 900).        % Goedel (*)
-ops.op_table("~=", after, xfx, 700).       % NU-Prolog (*)
-ops.op_table("!", before, fx, 40).         % Mercury extension
-ops.op_table("!.", before, fx, 40).        % Mercury extension
-ops.op_table("!:", before, fx, 40).        % Mercury extension
+:- pred ops.op_table(string::in, op_info::out, list(op_info)::out) is semidet.
+
+ops.op_table(Op, Info, OtherInfos) :-
+    % NOTE: Changes here may require changes to doc/reference_manual.texi.
+
+    % (*) means that the operator is not useful in Mercury
+    % and is provided only for compatibility.
 
-% (*) means that the operator is not useful in Mercury
-%     and is provided only for compatibility.
+    (
+    % The following symbols represent more than one operator.
+    % NOTE: The code of several other predicates above depends on the fact
+    % that no symbol represents more than *two* operators, by assuming that
+    % the length of OtherInfos cannot exceed one.
+
+        Op = "+",
+        Info = op_info(infix(y, x), 500),
+        % standard ISO Prolog
+        OtherInfos = [op_info(prefix(x), 500)]
+        % traditional Prolog (not ISO)
+    ;
+        Op = "-",
+        Info = op_info(infix(y, x), 500),
+        % standard ISO Prolog
+        OtherInfos = [op_info(prefix(x), 200)]
+        % standard ISO Prolog
+    ;
+        Op = ":-",
+        Info = op_info(infix(x, x), 1200),
+        % standard ISO Prolog
+        OtherInfos = [op_info(prefix(x), 1200)]
+        % standard ISO Prolog
+    ;
+        Op = "^",
+        Info = op_info(infix(x, y), 99),
+        % ISO Prolog (prec. 200, bitwise xor), Mercury (record syntax)
+        OtherInfos = [op_info(prefix(x), 100)]
+        % Mercury extension (record syntax)
+    ;
+    % The remaining symbols all represent just one operator.
+
+        % The following operators are standard ISO Prolog.
+        ( Op = "*",     Info = op_info(infix(y, x), 400)
+        ; Op = "**",    Info = op_info(infix(x, y), 200)
+        ; Op = ",",     Info = op_info(infix(x, y), 1000)
+        ; Op = "-->",   Info = op_info(infix(x, x), 1200)
+        ; Op = "->",    Info = op_info(infix(x, y), 1050)
+        ; Op = "/",     Info = op_info(infix(y, x), 400)
+        ; Op = "//",    Info = op_info(infix(y, x), 400)
+        ; Op = "/\\",   Info = op_info(infix(y, x), 500)
+        ; Op = ";",     Info = op_info(infix(x, y), 1100)
+        ; Op = "<",     Info = op_info(infix(x, x), 700)
+        ; Op = "<<",    Info = op_info(infix(y, x), 400)
+        ; Op = "=",     Info = op_info(infix(x, x), 700)
+        ; Op = "=..",   Info = op_info(infix(x, x), 700)
+        ; Op = "=:=",   Info = op_info(infix(x, x), 700)    % (*)
+        ; Op = "=<",    Info = op_info(infix(x, x), 700)
+        ; Op = "==",    Info = op_info(infix(x, x), 700)    % (*)
+        ; Op = "=\\=",  Info = op_info(infix(x, x), 700)    % (*)
+        ; Op = ">",     Info = op_info(infix(x, x), 700)
+        ; Op = ">=",    Info = op_info(infix(x, x), 700)
+        ; Op = ">>",    Info = op_info(infix(y, x), 400)
+        ; Op = "?-",    Info = op_info(prefix(x), 1200)     % (*)
+        ; Op = "@<",    Info = op_info(infix(x, x), 700)
+        ; Op = "@=<",   Info = op_info(infix(x, x), 700)
+        ; Op = "@>",    Info = op_info(infix(x, x), 700)
+        ; Op = "@>=",   Info = op_info(infix(x, x), 700)
+        ; Op = "\\",    Info = op_info(prefix(x), 200)
+        ; Op = "\\+",   Info = op_info(prefix(y), 900)
+        ; Op = "\\/",   Info = op_info(infix(y, x), 500)
+        ; Op = "\\=",   Info = op_info(infix(x, x), 700)
+        ; Op = "\\==",  Info = op_info(infix(x, x), 700)    % (*)
+        ; Op = "div",   Info = op_info(infix(y, x), 400)
+        ; Op = "is",    Info = op_info(infix(x, x), 701)    % ISO: prec 700
+        ; Op = "mod",   Info = op_info(infix(x, x), 400)
+        ; Op = "rem",   Info = op_info(infix(x, x), 400)
+        ),
+        OtherInfos = []
+    ;
+        % The following operator is a Goedel extension.
+        Op = "~",       Info = op_info(prefix(y), 900),     % (*)
+        OtherInfos = []
+    ;
+        % The following operators are NU-Prolog extensions.
+        ( Op = "~=",    Info = op_info(infix(x, x), 700)    % (*)
+        ; Op = "and",   Info = op_info(infix(x, y), 720)
+        ; Op = "or",    Info = op_info(infix(x, y), 740)
+        ; Op = "rule",  Info = op_info(prefix(x), 1199)
+        ; Op = "when",  Info = op_info(infix(x, x), 900)    % (*)
+        ; Op = "where", Info = op_info(infix(x, x), 1175)   % (*)
+        ),
+        OtherInfos = []
+    ;
+        % The following operators are Mercury/NU-Prolog extensions.
+        ( Op = "<=",    Info = op_info(infix(x, y), 920)
+        ; Op = "<=>",   Info = op_info(infix(x, y), 920)
+        ; Op = "=>",    Info = op_info(infix(x, y), 920)
+        ; Op = "all",   Info = op_info(binary_prefix(x, y), 950)
+        ; Op = "some",  Info = op_info(binary_prefix(x, y), 950)
+        ; Op = "if",    Info = op_info(prefix(x), 1160)
+        ; Op = "then",  Info = op_info(infix(x, x), 1150)
+        ; Op = "else",  Info = op_info(infix(x, y), 1170)
+        ; Op = "not",   Info = op_info(prefix(y), 900)
+        ; Op = "pred",  Info = op_info(prefix(x), 800)
+        ),
+        OtherInfos = []
+    ;
+        % The following operators are Mercury extensions.
+        ( Op = "!",                 Info = op_info(prefix(x), 40)
+        ; Op = "!.",                Info = op_info(prefix(x), 40)
+        ; Op = "!:",                Info = op_info(prefix(x), 40)
+        ; Op = "&",                 Info = op_info(infix(x, y), 1025)
+        ; Op = "++",                Info = op_info(infix(x, y), 500)
+        ; Op = "--",                Info = op_info(infix(y, x), 500)
+        ; Op = "--->",              Info = op_info(infix(x, y), 1179)
+        ; Op = ".",                 Info = op_info(infix(y, x), 10)
+        ; Op = "..",                Info = op_info(infix(x, x), 550)
+        ; Op = ":",                 Info = op_info(infix(y, x), 120)
+        ; Op = "::",                Info = op_info(infix(x, x), 1175)
+        ; Op = ":=",                Info = op_info(infix(x, x), 650)
+        ; Op = "==>",               Info = op_info(infix(x, x), 1175)
+        ; Op = "=^",                Info = op_info(infix(x, x), 650)
+        ; Op = "@",                 Info = op_info(infix(x, x), 90)
+        ; Op = "end_module",        Info = op_info(prefix(x), 1199)
+        ; Op = "event",             Info = op_info(prefix(x), 100)
+        ; Op = "finalise",          Info = op_info(prefix(x), 1199)
+        ; Op = "finalize",          Info = op_info(prefix(x), 1199)
+        ; Op = "func",              Info = op_info(prefix(x), 800)
+        ; Op = "import_module",     Info = op_info(prefix(x), 1199)
+        ; Op = "impure",            Info = op_info(prefix(y), 800)
+        ; Op = "include_module",    Info = op_info(prefix(x), 1199)
+        ; Op = "initialise",        Info = op_info(prefix(x), 1199)
+        ; Op = "initialize",        Info = op_info(prefix(x), 1199)
+        ; Op = "inst",              Info = op_info(prefix(x), 1199)
+        ; Op = "instance",          Info = op_info(prefix(x), 1199)
+        ; Op = "mode",              Info = op_info(prefix(x), 1199)
+        ; Op = "module",            Info = op_info(prefix(x), 1199)
+        ; Op = "pragma",            Info = op_info(prefix(x), 1199)
+        ; Op = "promise",           Info = op_info(prefix(x), 1199)
+        ; Op = "semipure",          Info = op_info(prefix(y), 800)
+        ; Op = "solver",            Info = op_info(prefix(y), 1181)
+        ; Op = "type",              Info = op_info(prefix(x), 1180)
+        ; Op = "typeclass",         Info = op_info(prefix(x), 1199)
+        ; Op = "use_module",        Info = op_info(prefix(x), 1199)
+        ),
+        OtherInfos = []
+    ;
+        ( Op = "arbitrary"
+        ; Op = "promise_equivalent_solutions"
+        ; Op = "promise_equivalent_solution_sets"
+        ; Op = "trace"
+        ),
+        Info = op_info(binary_prefix(x, y), 950),
+        OtherInfos = []
+    ;
+        ( Op = "promise_exclusive"
+        ; Op = "promise_exhaustive"
+        ; Op = "promise_exclusive_exhaustive"
+        ),
+        Info = op_info(prefix(y), 950),
+        OtherInfos = []
+    ;
+        ( Op = "promise_pure"
+        ; Op = "promise_pure_implicit"
+        ; Op = "promise_semipure"
+        ; Op = "promise_semipure_implicit"
+        ; Op = "promise_impure"
+        ; Op = "promise_impure_implicit"
+        ),
+        Info = op_info(prefix(x), 950),
+        OtherInfos = []
+    ).
 
 %-----------------------------------------------------------------------------%
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list