CS 541 Lecture -*- Outline -*- * Structural operational semantics of BeCecil work out the semantics of BeCecil in class. ** overview *** what has to be done ------------------------------------------ WHAT HAS TO BE DONE TO WRITE A SEMANTICS FOR BECECIL? Tasks: (informal understanding) concrete syntax (examples, informal explanations) abstract syntax big step or little step? data structures (domains) rules for each piece of syntax ------------------------------------------ or any language *** abstract syntax Q: Do we want recursive declaration sequences as a type? Q: What about class names? considerations: ease of writing programs, clarity, correspondence to the defining document. *** semantic domains **** objects ------------------------------------------ OBJECTS module object. import inherits set. % kind objectId = int. kind object type. ------------------------------------------ Q: How do we make objects? How to program oid? ... type mkObject int -> finite_rel int int -> set case -> set case -> object. type oid -> object -> int -> o. oid (mkObject ID I IS AS) ID. **** inheritance relationships Q: Why are inheritance relationships represented as things in BeCecil? ------------------------------------------ INHERITANCE RELATIONSHIPS module inherits. import finite_rel. type leq_inh finite_rel int int -> int -> int -> o. leq_inh I ID1 ID2 :- related I ID1 ID2. leq_inh I ID ID. ((leq_inh I ID1 ID2), (leq_inh I ID2 ID3)) => %------------------------------------- (leq_inh I ID1 ID3). ------------------------------------------ Q: Will this cause computational problems for us? Q: Can you write a \Prolog rule for ancestors membership (figure A-4)? **** generic functions discuss the broad outlines, and then closures, storage tables, and assignments case sets, applicability **** contexts, environments, elaborateds explain the distinctions and how they work **** stores similar to environments. How about allocation? *** rules describe how to code some in \Prolog start at the end (actual arguments, expressions, ...) and work back. Q: How would you write a little step semantics for BeCecil?