PageRenderTime 51ms CodeModel.GetById 15ms 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
Possible License(s): LGPL-3.0, GPL-3.0, LGPL-2.0, BSD-3-Clause, GPL-2.0, MIT
  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. Revision 1.6 1997/08/25 10:59:07 tms
  7. Immed fails if no progress has been achieved
  8. Revision 1.5 1997/07/11 13:26:58 tms
  9. Qrepl will fail if the LHS does not occur in the goal
  10. Revision 1.4 1997/05/08 13:46:27 tms
  11. Extended expansion mechanism relative to a path
  12. Revision 1.3 1997/02/17 17:39:01 tms
  13. added support for failed Assumption command
  14. Encountering an error, LEGO will raise an exception `error' provided
  15. by a structure Error:ERROR. The signatures ERROR and ERRORFORMATTING
  16. are defined in this file. A structure Errorformatting:ERRORFORMATTING
  17. will be used to implement the structure Error:ERROR in the file
  18. `error.sml'. An error is identified by its `ErrorSignal'
  19. encapsulating the `ErrorClass', the terms involved and, optionally,
  20. the number of the goal in question. The exception will be caught in
  21. the interface where an `ErrorHandler' will print an appropriate error
  22. message.
  23. ErrorClass terms Reason for triggering Error
  24. ---------- ----- ---------------------------
  25. ASSUMPTION [] no assumption closes the goal
  26. TYPEAPPLN [a,b] `Type (a b)' where `a b' is well-formed
  27. e.g. Type(([x:Type]x) Prop)
  28. APPLNTYPE [v,dom v,w,type of w] `v w' where the `dom v' is not equivalent to the
  29. `type of w', e.g. ([x:Prop]x) Prop
  30. APPLNNFUN [c,T] c of type T has been applied, but is not
  31. a function
  32. IMMED [] no assumption closed any goal
  33. PATH [c] the term c has been addressed with an
  34. illegal path e.g., Expand 2 Prop
  35. REPLLHS [c] the term c does not occur in the goal
  36. IMMED [] The tactic Immed was unsuccessful
  37. Currently, all other error messages are handled directly, but should
  38. be converted to use the new error handling structure `Error'.
  39. *)
  40. signature ERRORFORMATTING =
  41. sig
  42. type format
  43. val print : format -> unit
  44. val formatWord : string -> format
  45. val formatString : string -> format
  46. (* assumes that spaces seperate words *)
  47. val newline : format
  48. val block : int -> format list -> format
  49. val cnstr_format : bool -> cnstr -> format
  50. (* cnstr_format true yields an extended form
  51. cnstr_format false yields the standard form *)
  52. end;
  53. type ('a,'b) ErrorSignal = 'a*(int option)*('b list)
  54. signature ERROR =
  55. sig
  56. datatype ErrorClass = ASSUMPTION | TYPEAPPLN | APPLNTYPE | APPLNNFUN
  57. | PATH | REPLLHS |IMMED
  58. exception error of (ErrorClass,cnstr) ErrorSignal
  59. val ErrorHandler : (ErrorClass,cnstr) ErrorSignal -> unit
  60. end;