home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / misc / mas / mashelp / masrep.def < prev    next >
Encoding:
Modula Definition  |  1991-03-18  |  1.7 KB  |  56 lines

  1.  
  2. DEFINITION MODULE MASREP;
  3.  
  4. (* MAS Representation Definition Module. *)
  5.  
  6. FROM MASSTOR IMPORT LIST;
  7.  
  8.  
  9. PROCEDURE NewRep(): LIST;
  10. (*New representation. A new representation is returned. *)
  11.  
  12.  
  13. PROCEDURE SetRep(n,e,r: LIST);
  14. (*Set representation. r is a representation. n is a unique 
  15. label, e is an expression. *)
  16.  
  17.  
  18. PROCEDURE GetRep(n,r: LIST): LIST;
  19. (*Get representation. r is a representation. n is a unique 
  20. label, An expression e stored under n is returned. *)
  21.  
  22.  
  23. PROCEDURE CopyRep(r: LIST): LIST;
  24. (*Copy representation. r is a representation. A copy of r is 
  25. returned. Step counters are reset. *)
  26.  
  27.  
  28. PROCEDURE StepRep(r: LIST): LIST;
  29. (*Step through representation. r is a representation. 
  30. The next expression e and its label n are returned as pair (n,e). 
  31. If all pairs (n,e) of representation r have been processed, 
  32. then NIL is returned. *)
  33.  
  34.  
  35. PROCEDURE ForEachinRep(r, f, E: LIST): LIST;
  36. (*For each pair (n,e) in r apply function f. r is a representation. 
  37. (n, e) is a pair in r, where e is an expression and n is its label.
  38. f is applied to (n, e) such that p = f(n,e) with p = (n', e') or p = NIL. 
  39. If p <> NIL, then the pair (n', e') is added to the returned 
  40. representation r' = { n' e' : f(n,e) <> NIL, n e in r }. E is a 
  41. LISP environment, if E = NIL, then the top level environment is used. *)
  42.  
  43.  
  44. PROCEDURE FullRep(r: LIST): LIST;
  45. (*Full representation. Test for non-empty representation.
  46. r is a representation. *)
  47.  
  48.  
  49. PROCEDURE ForEachinList(r, f, E: LIST): LIST;
  50. (*For each element e in r apply function f. r is a list. e is an 
  51. element in r. f is applied to e such that e' = f(e). 
  52. E is a LISP environment, if E = NIL, then the top level environment 
  53. is used. *)
  54.  
  55. END MASREP.
  56.