Spring 2002, CSE 428: Quiz 2.2 - 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 scanner (circle only one answer, please)

    1. takes a parse tree and executes it
    2. takes a list of tokens and produces a parse tree
    3. translates the source code of a program into assembly code
    4. takes a program and produces a list of tokens
    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 grammar defining the language
    2. an abstract interpreter for the language
    3. the operations that the language is able to perform
    4. the definition of the static semantics of a program
    5. the operations performed by the compiler

  3. [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.



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


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

    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.