CSE 40243 Homework Assignments

Homeworks may be typed or handwritten as you prefer. Several homeworks require that you draw complex graphs that may get messy while you are solving the problem. Please take the time to re-draw graphs in an organized way on a clean sheet of paper before turning them in.

Homework #1

  • 3.1.1
  • 3.1.2 - Show TWO reasonable ways of scanning this HTML example. Briefly explain the difference between the two ways, and why you would choose one over the other.
  • 3.3.2 - Give the simplest possible English explanation of what strings each regular expression will accept.
  • 3.3.5
  • 3.3.9
  • Homework #2

  • 3.6.2
    Clarifications for 3.6.2: Please write your intended regular definition above the finite automata. You can get partial credit as long as the RE matches the FA. (a) Should have exactly five vowels a, e, i, o, u possibly interspersed with other symbols. (b) There should be no substrings that violate the ascending lexicographic order. (d) Omit this part. (e) Omit this part. (g) Omit this part.

  • 3.6.3
  • 3.7.3
  • 4.2.1
  • 4.2.4
  • 4.2.7
  • Homework #3

  • 4.4.1(a)
  • 4.4.1(b)
  • 4.4.3
  • Compute FIRST and FOLLOW for the grammar in exercise 4.2.2(g) on page 207.
  • Homework #4

  • Consider the following grammar:
    S -> id = E
    E -> E + P
    E -> P
    P -> id
    P -> (E)
    P -> id(E)
    
  • Draw the LR(0) automaton.
  • Write out the parse table for the same grammar.
  • Is this grammar LL(1)? Explain why.
  • Is this grammer LR(0)? Explain why.
  • Is this grammar SLR(1)? Explain why.
  • Is this grammar LR(1)? Explain why.