Exercise 1
(Scott 1.1)

--------------

Errors in a computer program can be classified according to when
they are detected and, if they are detected at compile time, what
part of the compiler detects them. Using your favorite imperative
language, give an example or each of the following.

(a) A lexical error, detected by the scanner
(b) A syntax error, detected by the parser
(c) A static semantic error, detected by semantic analysis
(d) A dynamic semantic error, detected by code generated by the
    compiler
(e) An error that the compiler can neither catch nor easily
    generate code to catch(this should be a violation of the language
    definition, not just a program bug)


Exercise 2
Please describe the characteristics of the following languages
--------------

∑ = {0, 1}


Exercise 3
Give a derivation
--------------

Given a grammar G = (Φ, Σ, P, S), where
Φ = {S, A, B, C, D}
S = {a, b, c, d, #}
P = {        S->ABCD | abc# A→aaA
                AB→aabbB
                BC→bbccC
                cC→cccC
                CD→ccd#
                CD→d#
                CD→#d                 }
Please give the derivation of string: aaaaaabbbbcccc#d.


Exercise 4
(Scott 1.2)

--------------

Algol family languages are typically compiled, while Lisp family languages, in
which many issues cannot be settled until run time, are typically interpreted. Is
interpretation simply what one “has to do” when compilation is infeasible, or are
there actually some advantages to interpreting a language, even when a compiler
is available? (What's the advantage and disadvantage of compiler and interpreter? )