

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















22c:111 Programming Language Concepts Fall 2008 Copyright 2007-08, The McGraw-Hill Company and Cesare Tinelli. These notes were originally developed by Allen Tucker, Robert Noonan and modified by Cesare Tinelli. They are copyrighted materials and may not be used in other course settings outside of the University of Iowa in their current form or modified form without the express written permission of one of the copyright holders. During this course, students are prohibited from selling notes to or being paid for taking notes by any person or commercial firm without the express written permission of one of the copyright holders.
M: Program โ State M: Statement x State โ State M: Expression x State โ Value
s_meaning: statement โ state โ state type statement = Skip (* ; ) | Block of statement list ( {โฆ} ) | Assign of string * expr ( x = a ) | Cond of expr * statement * statement ( if b s1 else s2 ) | Loop of expr * statement ( while (b) s *)
let rec s_meaning (s:statement) (q:state) = match s with โฆ | Assign (x, e) -> let v = e_meaning e q in State.update q x v | โฆ
let rec s_meaning (s:statement) (q:state) = match s with โฆ | Loop (e, sโ) -> (match (e_meaning e q) with B false -> q | B true -> s_meaning (Block [sโ; s]) q | _ -> failwith "Impossible caseโ ) | โฆ
let rec s_meaning (s:statement) (q:state) = match s with โฆ | Block [] -> q | Block sโ::t -> let qโ = s_meaning sโ q in s_meaning (Block t) qโ