home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / src / compiler / Asynt.sml < prev    next >
Encoding:
Text File  |  1997-08-18  |  3.4 KB  |  159 lines  |  [TEXT/R*ch]

  1. local
  2.   open Fnlib Mixture Const Globals Location Types;
  3. in
  4.  
  5. datatype IdKindDesc =
  6.     VARik
  7.   | PRIMik of PrimInfo
  8.   | CONik of ConInfo
  9.   | EXCONik of ExConInfo
  10. ;
  11.  
  12. type IdKind = IdKindDesc global;
  13.  
  14. type IdDesc =
  15. {
  16.   idLoc : Location,
  17.   withOp : bool,
  18.   idKind : IdKind ref
  19. };
  20.  
  21. type IdInfo = IdDesc global;
  22.  
  23. type TyVar = IdInfo;
  24.  
  25. datatype Ty' =
  26.     TYVARty of TyVar
  27.   | RECty of Ty Row
  28.   | CONty of Ty list * IdInfo
  29.   | FNty of Ty * Ty
  30. withtype Ty = Location * Ty'
  31. ;
  32.  
  33. datatype VarExpInfo =
  34.     RESve of IdInfo
  35.   | OVLve of IdInfo * OvlType * Type
  36. ;
  37.  
  38. datatype Pat' =
  39.     SCONpat of SCon * Type option ref
  40.   | VARpat of IdInfo
  41.   | WILDCARDpat
  42.   | NILpat of IdInfo
  43.   | CONSpat of IdInfo * Pat
  44.   | EXNILpat of IdInfo
  45.   | EXCONSpat of IdInfo * Pat
  46.   | EXNAMEpat of IdInfo          (* This is a hack to be used in match(.sml) *)
  47.   | REFpat of Pat
  48.   | RECpat of RecPat ref
  49.   | VECpat of Pat list
  50.   | INFIXpat of Pat list
  51.   | PARpat of Pat
  52.   | TYPEDpat of Pat * Ty
  53.   | LAYEREDpat of Pat * Pat
  54.  
  55. and RecPat =
  56.     RECrp of Pat Row * RowType option
  57.   | TUPLErp of Pat list
  58.  
  59. withtype Pat = Location * Pat'
  60. ;
  61.  
  62. datatype Exp' =
  63.     SCONexp of SCon * Type option ref
  64.   | VARexp of VarExpInfo ref
  65.   | RECexp of RecExp ref
  66.   | VECexp of Exp list
  67.   | LETexp of Dec * Exp
  68.   | PARexp of Exp
  69.   | APPexp of Exp * Exp
  70.   | INFIXexp of Exp list
  71.   | TYPEDexp of Exp * Ty
  72.   | ANDALSOexp of Exp * Exp
  73.   | ORELSEexp of Exp * Exp
  74.   | HANDLEexp of Exp * Match
  75.   | RAISEexp of Exp
  76.   | IFexp of Exp * Exp * Exp
  77.   | WHILEexp of Exp * Exp
  78.   | FNexp of Match
  79.   | SEQexp of Exp * Exp
  80.  
  81. and RecExp =
  82.     RECre of Exp Row
  83.   | TUPLEre of Exp list
  84.  
  85. and MRule = MRule of Pat list * Exp
  86.  
  87. and Dec' =
  88.     VALdec of TyVar list * (ValBind list * ValBind list)
  89.   | PRIM_VALdec of PrimValBind list
  90.   | FUNdec of TyVar list * FValBind list
  91.   | TYPEdec of TypBind list
  92.   | PRIM_TYPEdec of TyNameEqu * TypDesc list
  93.   | DATATYPEdec of DatBind list * TypBind list option
  94.   | ABSTYPEdec of DatBind list * TypBind list option * Dec
  95.   | EXCEPTIONdec of ExBind list
  96.   | LOCALdec of Dec * Dec
  97.   | OPENdec of string list
  98.   | EMPTYdec
  99.   | SEQdec of Dec * Dec
  100.   | FIXITYdec of InfixStatus * string list
  101.  
  102. and ValBind = ValBind of Pat * Exp
  103.  
  104. and FClause = FClause of Pat list * Exp
  105.  
  106. and ConBind = ConBind of IdInfo * Ty option
  107.  
  108. and ExBind =
  109.     EXDECexbind of IdInfo * Ty option
  110.   | EXEQUALexbind of IdInfo * IdInfo
  111.  
  112. withtype Exp = Location * Exp'
  113.  
  114. and Match = MRule list
  115.  
  116. and Dec = Location * Dec'
  117.  
  118. and PrimValBind = IdInfo * Ty * int * string
  119.  
  120. and FValBind = Location * FClause list
  121.  
  122. and TypBind = TyVar list * IdInfo * Ty
  123.  
  124. and TypDesc = TyVar list * IdInfo
  125.  
  126. and DatBind = TyVar list * IdInfo * ConBind list
  127. ;
  128.  
  129. type ValDesc = IdInfo * Ty;
  130. type ExDesc = IdInfo * Ty option;
  131.  
  132. datatype Spec' =
  133.     VALspec of ValDesc list
  134.   | PRIM_VALspec of PrimValBind list
  135.   | TYPEDESCspec of TyNameEqu * TypDesc list
  136.   | TYPEspec of TypBind list
  137.   | DATATYPEspec of DatBind list * TypBind list option
  138.   | EXCEPTIONspec of ExDesc list
  139.   | LOCALspec of Spec * Spec
  140.   | OPENspec of string list
  141.   | EMPTYspec
  142.   | SEQspec of Spec * Spec
  143. withtype Spec = Location * Spec';
  144.  
  145. type LocString = Location * string;
  146.  
  147. datatype Sig = 
  148.     NamedSig of {locsigid : LocString, specs : Spec list}
  149.   | AnonSig of Spec list;
  150.  
  151. datatype Struct =
  152.     NamedStruct of {locstrid : LocString, locsigid : LocString option,
  153.             decs : Dec list}
  154.   | Abstraction of {locstrid : LocString, locsigid : LocString, 
  155.             decs : Dec list}
  156.   | AnonStruct of Dec list
  157.  
  158. end;
  159.