Especially functional programming conceptsuse one language
CS 3520/6520
Programming Languages
Fall 2021
an object-oriented language
a functional language
lexical scope |
|
|
---|---|---|
λ-calculus |
|
���
CS 3520/6520 Programming Languages This course is about programming language concepts
Formal prerequisite: CS 3500
Informal prerequisite: more programming experience than thatGrading:
• Weekly homework (55%)
• Two mid-term exams (30%)
• Extended fnal homework (10%)
• Online quizzes (5%)
• Watch the videos before class
• Take the quiz before class
≥ 60% over semester ⇒ 100%
no late quizzes
• Learn concepts by implementinginterpreters
1+2 | ![]() |
---|
1��1�
Racket and Plait
• Implement interpreters using Plait, a variant of Racket Historically: Lisp⇒Scheme⇒Racket⇒Plait
PLAI = Programming Languages: Application and Interpretation, a textbook
Preview: Plait Tutorial
http://docs.racket-lang.org/plait/index.html
{ x=0 x>0 0 1
x<0 -1(cond
[(<x0)-1]
[(=x0)0]
[(>x0)1])
'(123)'(fx)
2��31
`{define{fx}
{+x1}}
(test (area(circle2))
12.56)
(test (area(rectangle34))
12)
33
(define-type Shape
(circle[radius:Number])
(rectangle[width:Number]
[height:Number])
(adjacent[left:Shape]
[right:Shape]))(define (areas)
(type-case Shapes
[(circler)(*3.14(*rr))]
[(rectanglewh)(*wh)]
[(adjacentlr)(+(areal)
(arear))]))
(define-type Shape
(circle[radius:Number])
(rectangle[width:Number]
[height:Number])
(adjacent[left:Shape]
[right:Shape]))(define (areas)
(type-case Shapes
[(circler)(*3.14(*rr))]
[(rectanglewh)(*wh)]
[(adjacentlr)(+(areal)
(arear))]))
(define-type Shape
(circle[radius:Number])
(rectangle[width:Number]
[height:Number])
(adjacent[left:Shape]
[right:Shape]))(define (areas)
(type-case Shapes
[(circler)(*3.14(*rr))]
[(rectanglewh)(*wh)]
[(adjacentlr)(+(areal)
(arear))]))