[m-rev.] diff: add some comments in prog_data.m
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Jun 17 17:48:22 AEST 2003
Estimated hours taken: 0.5
Branches: main
compiler/prog_data.m:
Add some comments.
Workspace: /home/ceres/fjh/mercury
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.93
diff -u -d -r1.93 prog_data.m
--- compiler/prog_data.m 8 May 2003 03:39:56 -0000 1.93
+++ compiler/prog_data.m 17 Jun 2003 07:46:52 -0000
@@ -56,6 +56,8 @@
cl_body :: goal
)
+ % `:- type ...':
+ % a definition of a type, or a declaration of an abstract type.
; type_defn(
td_tvarset :: tvarset,
td_ctor_name :: sym_name,
@@ -64,6 +66,8 @@
td_cond :: condition
)
+ % `:- inst ... = ...':
+ % a definition of an inst.
; inst_defn(
id_varset :: inst_varset,
id_inst_name :: sym_name,
@@ -72,6 +76,8 @@
id_cond :: condition
)
+ % `:- mode ... = ...':
+ % a definition of a mode.
; mode_defn(
md_varset :: inst_varset,
md_mode_name :: sym_name,
@@ -85,6 +91,10 @@
module_defn_module_defn :: module_defn
)
+ % `:- pred ...' or `:- func ...':
+ % a predicate or function declaration.
+ % This specifies the type of the predicate or function,
+ % and it may optionally also specify the mode and determinism.
; pred_or_func(
pf_tvarset :: tvarset,
pf_instvarset :: inst_varset,
@@ -104,6 +114,8 @@
% sugar that is expanded by equiv_type.m
% equiv_type.m will set these fields to `no'.
+ % `:- mode ...':
+ % a mode declaration for a predicate or function.
; pred_or_func_mode(
pfm_instvarset :: inst_varset,
pfm_which :: maybe(pred_or_func),
@@ -626,7 +638,17 @@
---> abstract
; concrete(list(class_method)).
+ % The name class_method is a slight misnomer;
+ % this type actually represents any declaration
+ % that occurs in the body of a type class definition.
+ % Such declarations may either declare class methods,
+ % or they may declare modes of class methods.
:- type class_method
+ % pred_or_func(...) here represents a `pred ...' or `func ...'
+ % declaration in a type class body, which declares
+ % a predicate or function method. Such declarations
+ % specify the type of the predicate or function,
+ % and may optionally also specify the mode and determinism.
---> pred_or_func(tvarset, inst_varset, existq_tvars, pred_or_func,
sym_name, list(type_and_mode), maybe(type),
maybe(inst), maybe(determinism),
@@ -636,6 +658,9 @@
% PredOrFunc, PredName, ArgTypes, WithType, Determinism,
% Cond, Purity, ClassContext, Context
+ % pred_or_func_mode(...) here represents a `mode ...'
+ % declaration in a type class body. Such a declaration
+ % declares a mode for one of the type class methods.
; pred_or_func_mode(inst_varset, maybe(pred_or_func), sym_name,
list(mode), maybe(inst), maybe(determinism),
condition, prog_context)
--
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-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