PageRenderTime 23ms CodeModel.GetById 12ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/lego-1.3.1/src/error-sig.sml

https://github.com/richardjuan/implementations
Standard ML (SML) | 82 lines | 18 code | 7 blank | 57 comment | 0 complexity | 6a74391665ff3ebca497027a2462e8a6 MD5 | raw file
 1(* error-sig.sml    Error handling for LEGO
 2   Author: Thomas Schreiber <tms@dcs.ed.ac.uk>
 3   $Log: error-sig.sml,v $
 4   Revision 1.7  1997/11/24 10:58:57  tms
 5   merged immed-may-fail with main branch
 6
 7   Revision 1.6  1997/08/25 10:59:07  tms
 8   Immed fails if no progress has been achieved
 9
10   Revision 1.5  1997/07/11 13:26:58  tms
11   Qrepl will fail if the LHS does not occur in the goal
12
13   Revision 1.4  1997/05/08 13:46:27  tms
14   Extended expansion mechanism relative to a path
15
16   Revision 1.3  1997/02/17 17:39:01  tms
17   added support for failed Assumption command
18 
19
20 Encountering an error, LEGO will raise an exception `error' provided
21 by a structure Error:ERROR. The signatures ERROR and ERRORFORMATTING
22 are defined in this file. A structure Errorformatting:ERRORFORMATTING
23 will be used to implement the structure Error:ERROR in the file
24 `error.sml'. An error is identified by its `ErrorSignal'
25 encapsulating the `ErrorClass', the terms involved and, optionally,
26 the number of the goal in question. The exception will be caught in
27 the interface where an `ErrorHandler' will print an appropriate error
28 message.
29
30 ErrorClass  terms                  Reason for triggering Error
31 ----------  -----                  ---------------------------
32
33 ASSUMPTION  []                     no assumption closes the goal 
34
35 TYPEAPPLN   [a,b]                  `Type (a b)' where `a b' is well-formed
36                                    e.g. Type(([x:Type]x) Prop)
37 APPLNTYPE   [v,dom v,w,type of w]  `v w' where the `dom v' is not equivalent to the
38                                    `type of w', e.g. ([x:Prop]x) Prop
39
40 APPLNNFUN   [c,T]                  c of type T has been applied, but is not
41                                    a function
42
43 IMMED       []                     no assumption closed any goal
44
45 PATH        [c]                    the term c has been addressed with an 
46                                    illegal path e.g., Expand 2 Prop
47
48 REPLLHS     [c]                    the term c does not occur in the goal
49
50 IMMED       []                     The tactic Immed was unsuccessful
51
52 Currently, all other error messages are handled directly, but should
53 be converted to use the new error handling structure `Error'.
54 *)
55
56signature ERRORFORMATTING =
57    sig
58	type format
59	val print : format -> unit
60	val formatWord : string -> format
61	    
62	val formatString : string -> format
63	(* assumes that spaces seperate words *)
64
65	val newline : format
66	    
67	val block : int -> format list -> format
68
69	val cnstr_format : bool -> cnstr -> format
70	(*  cnstr_format true  yields an extended form
71	    cnstr_format false yields the standard form *)
72    end;
73
74type ('a,'b) ErrorSignal = 'a*(int option)*('b list)
75
76signature ERROR =
77    sig
78	datatype ErrorClass = ASSUMPTION | TYPEAPPLN | APPLNTYPE | APPLNNFUN
79	  | PATH | REPLLHS |IMMED
80	exception error of (ErrorClass,cnstr) ErrorSignal
81	val ErrorHandler : (ErrorClass,cnstr) ErrorSignal -> unit
82    end;