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

  1.  
  2. DEFINITION MODULE MASLISP;
  3.  
  4. (* MAS Lisp Definition Module. *)
  5.  
  6.  
  7. (* Import lists and declarations. *)
  8.  
  9. FROM MASSTOR IMPORT LIST; 
  10.  
  11. CONST FEXPR   = 2;
  12.       MACRO   = 3;
  13.       GENERIC = 4;
  14.  
  15.  
  16. VAR TDEF, DEFAULT, ARROW, (*indicators*)
  17.  
  18.     ENV, (*global environement (alist)*)
  19.  
  20.     NULL, WT, SCHLUSS, TINFO,   
  21.  
  22.     EQS, NEQS, GTS, LTS, GEQ, LEQ, NOTS, UND, ODER,   
  23.  
  24.     ADD, SUB, MUL, QUOT, REM, POW,
  25.  
  26.     QUOTE, SETQ, COND, LISTX, 
  27.     ASSIGN, READ, WRITE, DECREAD, DECWRITE, 
  28.     
  29.     PROGN, VARS, IFS, WHL, RPT, STRNG, DE, DF, DM, DG,  
  30.     PROGA, GTO, LBEL, SETAV, ARY, ATM, RTN, ANY,
  31.  
  32.     UNIT, EXPOS, SPEC, SORT, SIG, IMPRT, IMPL, 
  33.     MODEL, MAP, AXIOM, RULE, WHEN, 
  34.    
  35.     LAMBDA, FLAMBDA, MLAMBDA, GLAMBDA: LIST;
  36.  
  37.     trace:  BOOLEAN; (*flag, if tracing evaluation*)
  38.     stricttyping: BOOLEAN; (*flag *)
  39.  
  40.     REP, FER, FERx, FEL, FELx, CONVVAL, CONVDES: LIST;
  41.  
  42.  
  43. PROCEDURE ECENV(ENV: LIST): LIST;
  44. (*Encode environment. The encoded environment E is returned. *)
  45.  
  46.  
  47. PROCEDURE DCENV(E: LIST): LIST;
  48. (*Decode environment. The encoded environment E is decoded. *)
  49.  
  50.  
  51. PROCEDURE SETV(V, A: LIST; VAR ENV: LIST);
  52. (*Set variable. V is a symbol and A is an S-expression. 
  53. A is associated to V in the environment ENV. *)
  54.  
  55.  
  56. PROCEDURE EXTENDENV(A, X: LIST; VAR ENV: LIST): BOOLEAN;
  57. (*Extend environement. A is a list of symbols. X is a list 
  58. of values. The environment ENV is extented by the bindings
  59. of the symbols in A to the values in X. If the binding
  60. is possible, then TRUE is returned else FALSE. *)
  61.  
  62.  
  63. PROCEDURE COPYTOENV(V, EP: LIST; VAR ENV: LIST);
  64. (*Copy to environement. V is a list of symbols. EP is an
  65. environment. The environment ENV is extented by the bindings
  66. of the symbols in V to the values in EP. *)
  67.  
  68.  
  69. PROCEDURE SPECIALFORM(S: LIST): BOOLEAN;
  70. (*Test if expression S is a special form. *)
  71.  
  72.  
  73. PROCEDURE LAMBDAP(S: LIST): BOOLEAN;
  74. (*Test if expression S is a lambda form. *)
  75.  
  76.  
  77. PROCEDURE SEXPRP(X: LIST): BOOLEAN;
  78. (*Test if X is a S-expression function. *)
  79.  
  80.  
  81. PROCEDURE DEFE(X: LIST; VAR ENV: LIST): LIST;
  82. (*Define expr function. X is a DE expression. A LAMBDA expression 
  83. generated from X is associated to name(X) in the environment ENV. *)
  84.  
  85.  
  86. PROCEDURE DEFF(X: LIST; VAR ENV: LIST): LIST;
  87. (*Define fexpr function. X is a DF expression. A FLAMBDA expression 
  88. generated from X is associated to name(X) in the environment ENV.*)
  89.  
  90.  
  91. PROCEDURE DEFM(X: LIST; VAR ENV: LIST): LIST;
  92. (*Define macro function. X is a DM expression. A MLAMBDA expression 
  93. generated from X is associated to name(X) in the environment ENV.*)
  94.  
  95.  
  96. PROCEDURE DEFMAP(X: LIST; VAR ENV: LIST): LIST;
  97. (*Define generic map function. X is a MAP expression. A 
  98. GLAMBDA expression generated from X is associated to name(X) 
  99. in the environment ENV. *)
  100.  
  101.  
  102. PROCEDURE DEFPROC(X: LIST; VAR ENV: LIST): LIST;
  103. (*Define generic proc function. X is a DE expression. 
  104. A GLAMBDA expression generated from X is associated to 
  105. name(X) in the environment ENV.*)
  106.  
  107.  
  108. PROCEDURE DEFRULE(X: LIST; VAR ENV: LIST): LIST;
  109. (*Define generic rule function. X is a RULE expression. 
  110. A GLAMBDA expression generated from X is associated to 
  111. name(X) in the environment ENV.*)
  112.  
  113.  
  114. PROCEDURE DSPEC(X: LIST; VAR ENV: LIST): LIST;
  115. (*Define specification. X is a SPEC expression. An UNIT expression 
  116. generated from X is associated to name(X) in the environment ENV.*)
  117.  
  118.  
  119. PROCEDURE DMIA(X: LIST; VAR ENV: LIST): LIST;
  120. (*Define model, implementation or axioms. X is a MODEL, 
  121. IMPLEMENTATION or AXIOMS expression. An UNIT expression 
  122. associated to name(X) is modified by a generated expression 
  123. of X. *)
  124.  
  125.  
  126. PROCEDURE TYPEOF(X: LIST): LIST;
  127. (*Type of S-expression. X is an S-expression. A list of types, 
  128. values and descriptors of X is returend. *)
  129.  
  130.  
  131. PROCEDURE TAG(V,T: LIST): LIST;
  132. (*Tag object. V is an S-expression, T is a type expression.
  133. A tagged TYPEINFO S-expression is returned. *)
  134.  
  135.  
  136. PROCEDURE VALOFTAG(L: LIST): LIST;
  137. (*Value of tagged object. L is a tagged S-expression. 
  138. The value component of L is returned. *)
  139.  
  140.  
  141. PROCEDURE TYPOFTAG(L: LIST): LIST;
  142. (*Type of tagged object. L is a tagged S-expression. 
  143. The type component of L is returned.*)
  144.  
  145.  
  146. PROCEDURE DECOFTAG(L: LIST): LIST;
  147. (*Descriptor of tagged object. L is a tagged S-expression. 
  148. The descriptor component of L is returned. *)
  149.  
  150.  
  151. PROCEDURE GENPL(P,V,T,D: LIST): LIST;
  152. (*Generate parameter list. P is a list of patterns. 
  153. V is a list of values. T is a list of types and D is a 
  154. list of descriptors. A parameter list is returned. *)
  155.  
  156.  
  157. PROCEDURE GENTE(Z,N,D: LIST): LIST;
  158. (*Generate typed expression. Z is an S-expression,
  159. N is a function name, D is a descriptor. A typed S-expression 
  160. for evaluation is returned. *)
  161.  
  162.  
  163. END MASLISP.
  164.  
  165.  
  166.  
  167.