Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CMSC 631, Fall 2007: Monotonicity of Extended Function Grammar and Lattice, Assignments of Computer Science

The fourth homework assignment for the cmsc 631 course, due in class on october 22, 2007. The assignment covers topics related to monotonicity of functions with extended grammar, lattice of functions, and ensuring definite initialization in a programming language through dataflow analysis. Students are required to prove if functions with the extended grammar are still monotonic, explain the monotonicity of a transfer function, show that the lattice of functions is also a lattice, determine the height of the lattice, and design a dataflow analysis to ensure definite initialization.

Typology: Assignments

Pre 2010

Uploaded on 02/13/2009

koofers-user-efp
koofers-user-efp 🇺🇸

5

(1)

10 documents

1 / 1

Toggle sidebar

Related documents


Partial preview of the text

Download CMSC 631, Fall 2007: Monotonicity of Extended Function Grammar and Lattice and more Assignments Computer Science in PDF only on Docsity! CMSC 631, Fall 2007 Homework 4 Due Monday, Oct. 22, in class 1. Recall from Homework 1 that you proved that functions consisting of any combination of set union, intersection, or constant sets s in some domain S are monotonic. Suppose that we extend the grammar we used to include the complement operator, so functions f(x) = e are defined with e as e ::= x | s | e ∪ e | e ∩ e | !e The semantics of complement !T is the set S−T (or put another way, eval !e v = S - (eval e v)). (a) Are functions f(x) = e still guaranteed to be monotonic? If so, justify your answer. If not, provide a counterexample. (b) Explain why a transfer function defined by Out(stmt) = Gen(stmt) ∪ (In(stmt) - Kill(stmt)), which seems to include negation, is monotonic. 2. Let A be a lattice, with order ≤. Define A → A to be the set of all functions from A to A, and define f ≤′ g iff f(x) ≤ g(x) for all x ∈ A. • Show that A → A with order ≤′ is also a lattice. That is, show that for all f, g ∈ A → A, f t g and f u g always exist. • Suppose lattice A has height h and that A is finite with n elements. What is the height of the lattice (A → A,≤′)? (When counting height, count “edges” rather than “nodes,” e.g., if A were the lattice {a, b} with a < b, then its height would be 1.) 3. A programming language ensures definite initialization when no program in the language is able to read a variable before it is initialized (written). Your task is to ensure that this property holds by designing a dataflow analysis on our language of commands (not including lists): variables x, y, z ∈ V integers i, j, k ∈ Z expressions e ::= x | i | e1 + e2 | e1 ∗ e2 commands c, d ::= skip | x := e | ifnot0 e then c1 else c2 | whilenot0 e do c | c1; c2 Write down the following about your analysis: (a) State precisely what your analysis aims to do. Explain how this will be used to ensure definite initialization. (b) Give the direction of your analysis. (c) Define the lattice, and define the meet operation. (d) State how you would initialize the dataflow facts at each program point, including the entry or exit nodes, as appropriate. (e) Give the transfer functions (e.g., in terms of Gen and Kill functions) for each statement, where for if and while the transfer function should be for the guards.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved