Lec15 - CMPSC 461: Programming Language Concepts Lecture 15...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPSC 461: Programming Language Concepts Lecture 15 Instructor: Prof. Swarat Chaudhuri
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The LET language Prog ::= Exp Exp ::= Number ::= - (Exp, Exp) ::= zero? Exp ::= if Exp then Exp else Exp ::= let Id = Exp in Exp
Background image of page 2
Abstract syntax Program: a-program (exp1) Expression: const-exp (num) diff-exp (exp1 exp2) zero?-exp (exp1) if-exp (exp1 exp2 exp3) var-exp (var) let-exp (var exp1 body)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
For example > (scan-parse-let "if zero? -(55,x) then -(x,10) else -(y,11)") #(struct:a-program #(struct:if-exp #(struct:zero?-exp #(struct:diff-exp #(struct:const-exp 55) #(struct:var-exp x))) #(struct:diff-exp #(struct:var-exp x) #(struct:const-exp 10)) #(struct:diff-exp #(struct:var-exp y) #(struct:const-exp 11))))
Background image of page 4
What values do programs manipulate? What’s the value of an expression in a given situation? What’s the value that the program computes in a given situation? First we specify. Then we implement to satisfy specification.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

Lec15 - CMPSC 461: Programming Language Concepts Lecture 15...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online