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

CS 784 Spring 2009 Final Exam: Static Fields, Attribute Grammars, Axiomatic Semantics, Exams of Programming Languages

The final exam for cs 784 spring 2009 at wright state university's department of computer science and engineering. The exam covers various topics including static fields in object-oriented programming languages, attribute grammars, axiomatic semantics, and algebraic specification. Students are required to explain modifications to the interpreter code to incorporate static fields, write an attribute grammar for base-3 numerals, determine weakest preconditions for given code snippets, and give an algebraic specification for the int bag adt. Essential for university students specializing in computer science and engineering.

Typology: Exams

Pre 2010

Uploaded on 08/16/2009

koofers-user-8zm
koofers-user-8zm 🇺🇸

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download CS 784 Spring 2009 Final Exam: Static Fields, Attribute Grammars, Axiomatic Semantics and more Exams Programming Languages in PDF only on Docsity! Wright State University Department of Computer Science and Engineering CS 784 Spring 2009 Prasad Final Exam (40 pts) 1 Interpreter for Object-Oriented Language (8 + 8 pts) Consider the interpreter for OOPL given in the files 5-3.scm and 5-4-4.scm. We explore introducing static fields into class definitions. Static fields associate some state with a class; all the instances of a class share this state. Static fields can appear in a method body. For example, one might write the following program and obtain as the result, the list (01): class c1 static next_serial_number field my_serial_number method get_serial_number () my_serial_number method initialize () begin set my_serial_number = next_serial_number; set next_serial_number = add1(next_serial_number); end let o1 = new c1() o2 = new c1() in list (send o1 get_serial_number(), send o2 get_serial_number()) Explain all the modifications to the interpreter code to incorporate the static fields shown in the grammar rule for class definition below, informally and clearly first, and formally in code later. Initialize each static field to 0, by default. (class-decl ("class" identifier "extends" identifier (arbno "static" identifier) (arbno "field" identifier) (arbno method-decl) ) a-class-decl) Specifically, locate all the changes to the original interpreter code on the accompanying interpreter code handout and/or locate changes/insertions using file name, page number, and line numbers. 1
Docsity logo



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