Spring 2002, CSE 428: Quiz 2.1 - 24 Jan 2002


Please write your Name, Student ID, and Section at the top of the page.
  1. [Points 2] What is the typical function of a parser (circle only one answer, please)

    1. takes a program and typechecks it
    2. takes a parse tree and executes it
    3. takes a list of tokens and produces a parse tree
    4. translates the source code of a program into assembly code
    5. takes a grammar and produces all possible parse trees

  2. [Points 2] What is the operational semantics of a programming language (circle only one answer, please)

    1. the specification of an abstract interpreter for the language
    2. the grammar defining the language
    3. the set of operations that the language is able to perform
    4. the set of rules that define the static correctness of a program
    5. the operations done by the compiler

  3. [Points 3] Consider the following rule for assignment:


                  sigma |- Exp eval Val
       ____________________________________________
       sigma |-  X = Exp ===> sigma union {(X,Val)}
    

    Here, union is the usual set union operator. Why is placing union in this inference rule wrong? (Circle only one answer.)

    1. Val might be associated two different variables.
    2. The result of the union might be empty.
    3. X might have two values in the union.
    4. The union should be interaction.

  4. [Points 3] Consider a declaration such as the following:
    
      int  x, y.
      bool b, c.
    

    This specification declares that two variables are integer and two are boolean. What is the type mapping that is intended by this declaration? Write your answer as a set of pairs.