Programming Languages (CSC-302 99S)


Class 28: Discussion of Exam 2

Back to An Expression Grammar. On to Ambiguous Grammars, Concluded.

Held Monday, April 12

Summary

Contents


Notes


The Exam

The Semantics of Read()

The valueslist helper

A quiz (which you may discuss as a class or in small groups; each group should turn in one set of solutions). You may want to use the Scheme semantics for this and the next quiz.

Consider the following two functions (@ is the simple I've used for down-arrow; S@n means ``select the nth element of S''; : is used for concatenation.)

foo :: E -> T
foo =
  \ exp . if (exp in Ep) then foo ((exp|Ep) @ 2)
          else if (exp = null) then true
          else false

bar :: E -> (E union {bozo})*
  \ exp . if (exp in Ep) then
            <(exp|Ep) @ 1>:(bar ((exp|Ep) @ 2))
          else if (exp = null) then <>
          else bozo

a. What does foo do?

b. What does bar do?

c. What does this say about valueslist?

Equivalence

A quiz (which you may discuss as a class or in small groups; each group should turn in one set of solutions). You may want to use the Scheme semantics for this quiz.

Do not execute the following code!

What is the value of (eqv? (cons 'a 'b) (cons 'a 'b))? Why? (You'll probably want to refer to the descriptions of cons and eqv.)


History


Back to An Expression Grammar. On to Ambiguous Grammars, Concluded.


Disclaimer Often, these pages were created ``on the fly'' with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.

This page may be found at http://www.math.grin.edu/~rebelsky/Courses/CS302/99S/Outlines/outline.28.html

Source text last modified Thu Apr 15 09:12:40 1999.

This page generated on Thu Apr 15 10:09:58 1999 by SiteWeaver. Validate this page's HTML.

Contact our webmaster at rebelsky@math.grin.edu