Interp-LET - Click to edit Master subtitle style CS784...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: Click to edit Master subtitle style CS784 Study Semantics of Programming Languages through Interpreters CS784 22 Interpreter vs Compiler Input : Abstract Syntax of a program (AST) Output :Meaning of the program An interpreter carries out the meaning of a program. A compiler transforms a program in one language into a program in a lower-level language preserving the meaning . CS784 CS784 Fig 3.2: the LET language CS784 33 CS784 Fig 3.2: the LET language Program :: = Expression a-program (exp1) Expression :: = Number const-exp (num) Expression :: = -(Expression , Expression) diff-exp (exp1 exp2) Expression :: = zero? (Expression) zero?-exp (exp1) Expression :: = if Expression then Expression else Expression if-exp (exp1 exp2 exp3 ) CS784 44 CS784 Examples of let let x = 5 in -(x,3) let z = 5 in let x = 3 in let y = -(x,1) % here x = 3 in let x = 4 in -(z, -(x,y)) % here x = 4 let x = 7 in let y = 2 in let y = CS784 55 CS784 run, value-of-program CS784 66 CS784...
View Full Document

This note was uploaded on 06/02/2011 for the course CS 784 taught by Professor Tkprasad during the Spring '11 term at New York Institute of Technology-Westbury.

Page1 / 26

Interp-LET - Click to edit Master subtitle style CS784...

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

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