



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Memon; Class: ORGNZTN PROGM LANG; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;
Typology: Study notes
1 / 5
This page cannot be seen from the preview
Don't miss anything!




CMSC 330 2
CMSC 330 3
CMSC 330 4
CMSC 330 5
The lambda calculus was created by logician Alonzo Church in the 1930's to formulate a mathematical logical system true = x.y.x false = x.y.y
CMSC 330 6
CMSC 330 7
*(Named after Alonzo Church, developer of lambda calculus)
CMSC 330 9
iszero 0 = (z.z (y.false) true) (f.y.y) (f.y.y) (y.false) true (y.y) true true CMSC 330 10
CMSC 330 11
CMSC 330 12
CMSC 330 19
CMSC 330 21
A n : int
e ::= n | x | x:t.e | e e
A x : A(x)
x A
A x:t.e : t t'
A, x : t e : t' A e e' : t'
A e : t t' A e' : t
CMSC 330 22
A (x:int.+ x 3) 4 : int
A = + : int int int
A (x:int.+ x 3) : int int A 4 : int
B + x 3 : int
B 3 : int
B + : iii B + x : int int
B x : int
B = A, x : int
CMSC 330 23
(Write this in OCaml!) TypeCheck : type env expression type
TypeCheck(A, n) = int TypeCheck(A, x) = if x in A then A(x) else fail TypeCheck(A, x:t.e) = let t' = TypeCheck((A, x:t), e) in t t' TypeCheck(A, e1 e2) = let t1 = TypeCheck(A, e1) in let t2 = TypeCheck(A, e2) in if dom(t1) = t2 then range(t1) else fail
CMSC 330 25
CMSC 330 26
CMSC 330 27