Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/branches/SMLNJ/src/MLRISC/library/annotations.sml
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/MLRISC/library/annotations.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 245, Sat Apr 17 18:47:12 1999 UTC revision 411, Fri Sep 3 00:25:03 1999 UTC
# Line 1  Line 1 
1    (*
2     *  User definable annotations.
3     *
4     *  Note: annotations will now be used extensively in all part of
5     *  the optimizer.
6     *
7     *  Idea is stolen from Stephen Weeks
8     *
9     *  -- Allen
10     *)
11    
12  structure Annotations : ANNOTATIONS =  structure Annotations : ANNOTATIONS =
13  struct  struct
14    
15     type annotation = exn     type annotation = exn
16     type annotations = annotation list     type annotations = annotation list
17    
18     exception COMMENT of string     val prettyPrinters = ref [] : (annotation -> string) list ref
19    
20     fun toString(COMMENT s) = s     fun attachPrettyPrinter p = prettyPrinters := p :: !prettyPrinters
21       | toString e          = "<"^exnName e^">"  
22       fun toString a =
23       let fun pr([]) = "<"^exnName a^">"
24             | pr(p::ps) = (p a handle _ => pr ps)
25       in  pr(!prettyPrinters) end
26    
27     (*     (*
28      * Look ma, a real use of generative exceptions!      * Look ma, a real use of generative exceptions!
# Line 36  Line 51 
51    
52  end  end
53    
 (*  
  * $Log$  
  *)  

Legend:
Removed from v.245  
changed lines
  Added in v.411

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0