CS 313 - Homework 1 - Computer languages, syntax, grammars

Due: Wednesday 2/18 in class

On the first page, write your own name as well as the names of the students with whom you collaborated. Remember that you may discuss the problems with other students but must write them up individually and may not refer to current or past solutions. Please write legibly!
  1. Read Sethi Chapters 1 and 2.

  2. Sethi pp. 21-22, problems 1.1, 1.9

  3. Sethi pp. 49-52, problems 2.1, 2.2, 2.3, 2.4, 2.10, 2.11, 2.21

  4. Modify the context-free grammar for variables given in class to allow the following more general class of identifiers:

    Legal examples: Cost_1, cost_1, Cost, C_o_s_t, 1_c
    Illegal examples:

    cost      (no uppercase letter or digit)
    _Cost    (begins with an underscore)
    1234     (no letters)
    12__A   (two consecutive underscores)

  5. How much time did it take you to complete this assignment?