10.2 Terms and Types

 < Free Open Study > 



10.2 Terms and Types

The syntax of types is transcribed directly into an ML datatype from the abstract syntax in Figures 8-1 and 9-1.

   type ty =       TyBool     | TyArr of ty * ty 

The representation of terms is the same as we used for the untyped lambda-calculus (p. 84), just adding a type annotation to the TmAbs clause.

   type term =       TmTrue of info     | TmFalse of info     | TmIf of info * term * term * term     | TmVar of info * int * int     | TmAbs of info * string * ty * term     | TmApp of info * term * term 



 < Free Open Study > 



Types and Programming Languages
Types and Programming Languages
ISBN: 0262162091
EAN: 2147483647
Year: 2002
Pages: 262

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net