| 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 |
signature ANNOTATIONS = |
| 13 |
sig |
| 14 |
|
| 15 |
type annotation |
| 16 |
type annotations = annotation list |
| 17 |
type propList = annotations |
| 18 |
|
| 19 |
exception NoProperty |
| 20 |
|
| 21 |
type 'a property = |
| 22 |
{ get : annotations -> 'a option, |
| 23 |
peek : annotation -> 'a option, |
| 24 |
lookup : annotations -> 'a, |
| 25 |
contains : annotations -> bool, |
| 26 |
set : 'a * annotations -> annotations, |
| 27 |
rmv : annotations -> annotations, |
| 28 |
create : 'a -> annotation |
| 29 |
} |
| 30 |
type flag = unit property |
| 31 |
|
| 32 |
(* |
| 33 |
* Generate a new annotation. |
| 34 |
* Client should provide a pretty printing function. |
| 35 |
*) |
| 36 |
val new : ('a -> string) option -> 'a property |
| 37 |
val new' : {toString: 'a -> string, |
| 38 |
get : exn -> 'a, |
| 39 |
create : 'a -> exn |
| 40 |
} -> 'a property |
| 41 |
|
| 42 |
(* |
| 43 |
* Pretty print an annotation |
| 44 |
*) |
| 45 |
val toString : annotation -> string |
| 46 |
|
| 47 |
(* |
| 48 |
* Attach a pretty printer |
| 49 |
*) |
| 50 |
val attachPrettyPrinter : (annotation -> string) -> unit |
| 51 |
|
| 52 |
end |