Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/compiler/FLINT/kernel/ltybasic.sml
ViewVC logotype

Diff of /sml/trunk/compiler/FLINT/kernel/ltybasic.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 53, Mon Mar 23 04:02:58 1998 UTC revision 65, Wed Apr 1 20:57:44 1998 UTC
# Line 253  Line 253 
253   *            UTILITY FUNCTIONS ON TKIND ENVIRONMENT                       *   *            UTILITY FUNCTIONS ON TKIND ENVIRONMENT                       *
254   ***************************************************************************)   ***************************************************************************)
255    
256  (** tkind environment: maps each tyvar, i.e., its debindex, to its kind *)  type tkindEnv = LK.tkindEnv
257  type tkindEnv = tkind list list  exception tkUnbound = LK.tkUnbound
258    val initTkEnv = LK.initTkEnv
259  (** utility functions for manipulating the tkindEnv *)  val tkLookup = LK.tkLookup
260  exception tkUnbound  val tkInsert = LK.tkInsert
 val initTkEnv : tkindEnv = []  
   
 fun tkLookup (kenv, i, j) =  
   let val ks = List.nth(kenv, i-1) handle _ => raise tkUnbound  
    in List.nth(ks, j) handle _ => raise tkUnbound  
   end  
   
 fun tkInsert (kenv, ks) = ks::kenv  
   
 (* strip any unused type variables out of a kenv, given a list of  
  * [encoded] free type variables.  the result is a "parallel list" of  
  * the kinds of those free type variables in the environment.  
  * --CALeague  
  *)  
 fun tkLookupFreeVars (kenv, ftvs) =  
     let  
         fun g (kenv, d, []) = []  
           | g (kenv, d, ftv::ftvs) =  
             let val (d', i') = LtyKernel.tvDecode ftv  
                 val kenv' = List.drop (kenv, d'-d)  
                     handle _ => raise tkUnbound  
                 val k = List.nth (hd kenv', i')  
                     handle _ => raise tkUnbound  
                 val rest = g (kenv', d', ftvs)  
             in  
                 k :: rest  
             end  
     in  
         g (kenv, 1, ftvs)  
     end  
261    
262  (***************************************************************************  (***************************************************************************
263   *            UTILITY FUNCTIONS ON TYC ENVIRONMENT                         *   *            UTILITY FUNCTIONS ON TYC ENVIRONMENT                         *

Legend:
Removed from v.53  
changed lines
  Added in v.65

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0